Is it possible to make an only minutes (1m) countdown in a Live Activity?
Asked Answered
S

0

8

It's weird because in documentation (SwiftUI, Live Activities, Dynamic Island) I keep seeing images like:

enter image description here

Or even

enter image description here

And in iPhone clock app (timer):

enter image description here

But it seems like the only way to make a functional timer is:

Text(context.state.startTime, style: .timer)

But it's very limited when it comes to formatting.

It has it's own behaviors for example on Stand by mode; it changes to things like: "< 1 minute" or "5 minutes" but on the dynamicIsland limited space its not helping. You end with "2:45:56" when maybe you need "2h"

Is any way to achieve this behavior that we se so often in Docs and videos?

Smirch answered 26/11, 2023 at 11:39 Comment(4)
You are supposed to update the live activity using push notifications. See developer.apple.com/documentation/activitykit/…Gradey
I don't think that updating a local timer through a server with push notifications every minute for hours only to show a different format of String is the right solution for me. @GradeySmirch
Hey Fran, did you ever find a solution to this? I'm having the exact same usecase.Latreese
Hey @Latreese not yet I used as it is. Hopefully with new updates some changes come.Smirch

© 2022 - 2025 — McMap. All rights reserved.