[ad_1]
iOS Live Activities + multi-phase timers (Pomodoro / boxing rounds) without push notifications β is proper sync even possible?
Hey everyone π
Iβm building a Pomodoro timer and a boxing/round timer in SwiftUI and want them to work nicely with Live Activities (Lock Screen + Dynamic Island). Both have the same core idea: a timer with multiple phases (work/rest or round/break), and Iβd like:
-
a circular timer + countdown in the app,
-
a Live Activity showing the current phase + countdown,
-
and automatic phase changes (e.g. work β rest β work, or round β break β round) that stay in sync between the app and the Live Activity.
What Iβve tried:
-
Classic
endTimeinContentStateandText(endTime, style: .timer)in the widget β works for a single phase, but when the time is up and the app is suspended, the Live Activity hits 0:00 and just stays there (or starts counting up), because the app canβt callupdate(...)anymore. -
A pattern-based approach (store
sessionStart,workDuration,restDurationand compute the phase based onDate()in the widget) β the Live Activity UI isnβt reliably recomputed every second, and youβre basically fighting ActivityKitβs design. -
Hybrid: app runs its own timer and calls
update(...)on phase changes β works only while the app is alive. Once iOS suspends it in the background, no more updates β Live Activity stops changing phase.
Constraints:
I explicitly donβt want to use a backend or ActivityKit push updates β only local logic.
So my question:
π Is it actually possible, purely locally (no server, no push), to keep a multi-phase timer (work/rest, rounds/breaks) and a Live Activity truly in sync, including automatic phase transitions while the device is locked?
If youβve shipped a timer/interval/workout app that does this without a backend, how are you handling phase changes and keeping the in-app timer + Live Activity in sync?
Right now my only βhonestβ solution seems to be: one Live Activity per current phase (just count down to 0:00) and then rely on a notification / user interaction to start the next phase. Curious if anyone has a better approach.
[ad_2]
Source link