I am trying to use a timer for an exercise app on Apple Watch (timer used for resting time after an exercise) but this timer stops when the watch goes in sleep mode (triggered by a wrist down). This is very unpractical as the user does the wrist down naturally during resting and the timer is stopped.
I am using a basic timer with publish and on receive:
but it does not work whenever the user does a wrist down.
Can you please let me know how should I use the timer in order to work even in sleep mode? I see that the Apple Exercise app timer works even in sleep mode. Therefore, that should be doable.
Thank you in advance for your help
I am using a basic timer with publish and on receive:
Code Block Swift let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
Code Block Swift .onReceive(timer) { _ in if timeRemaining > -1 { timeRemaining -= 1 }
but it does not work whenever the user does a wrist down.
Can you please let me know how should I use the timer in order to work even in sleep mode? I see that the Apple Exercise app timer works even in sleep mode. Therefore, that should be doable.
Thank you in advance for your help