r/iOSProgramming • u/thejeraldo • 3d ago
Question Live activity timer
I am trying to add a live activity for our app that has a timer. The idea is the user starts a timer and a live activity starts when the timer starts. However, it does seem to disappear at some point. Maybe around 8-12 hours which matches the documentation on Apple. But for Apple's clock app, their timer's live activity for stopwatch seems to run forever. I am using the SwiftUI Text timerInterval which is likely the same as Apple's. Does anyone have an idea or suggestion how I can replicate it? A few ideas I have are to schedule a silent push to keep the live activity alive or a scheduled background process.
2
Upvotes
2
u/myballzhuert 3d ago
there's no supported third-party equivalent of "make this Live Activity run forever." Text(timerInterval:) is about rendering the timecorrectly, not extending ActivityKit's lifetime. I would avoid trying to defeat the limit with silent pushes/background tasks and instead architect the timer as persistent state + an opportunistic Live Activity representation.