Skip to content

feat(ios): add minutes text style to Timer - #333

Closed
Titozzz wants to merge 1 commit into
callstackincubator:mainfrom
Titozzz:feat/ios-timer-minutes-style
Closed

Titozzz wants to merge 1 commit into
callstackincubator:mainfrom
Titozzz:feat/ios-timer-minutes-style

Conversation

@Titozzz

@Titozzz Titozzz commented Sep 29, 2026

Copy link
Copy Markdown

What is this?

Timer gets a new textStyle: 'minutes' option. It shows a live countdown or count-up without seconds, for example "19 minutes" instead of 19:42. Seconds are often noise in Live Activities that track something on the scale of minutes or hours, such as a shift or an appointment starting soon. Until now, the only live-updating styles ('timer' and 'relative') both showed seconds.

How does it work?

On iOS 18 and later, the timer renders Text(.currentDate, format: .offset(to:allowedFields:sign:)). This is SwiftUI's SystemFormatStyle.DateOffset, which the system keeps up to date on its own, just like Text(timerInterval:), with no push or app update needed. The allowed fields are minutes only, or hours and minutes when showHours is set. The sign is hidden, so countdowns and count-ups read the same way. The target date follows the same rules as the 'relative' style: the end of the interval when counting down, the start when counting up. The output is localized by the system.

On earlier iOS versions, 'minutes' falls back to the existing 'timer' style. The schema, the generated TypeScript and Swift parameter docs, and the website's Timer documentation are updated to match.

Why is this useful?

Apps can show a calm, readable "Starts in 19 minutes" or "Started 12 minutes ago" in Live Activities and widgets that still updates on its own. That matches how people think about longer intervals. Before this, apps had to choose between a ticking mm:ss clock and static text that goes stale.

🤖 Generated with Claude Code

`textStyle: 'minutes'` renders a live-updating countdown or count-up without
seconds (e.g. "19 minutes") using SwiftUI's `SystemFormatStyle.DateOffset`.
It requires iOS 18 and falls back to the default timer style on earlier
versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Titozzz
Titozzz marked this pull request as draft September 29, 2026 14:46
@Titozzz

Titozzz commented Sep 29, 2026

Copy link
Copy Markdown
Author

Closing for now, will reopen if needed, sorry for the noise !

@Titozzz Titozzz closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant