I have a Text
that acts as a timer with different values of my array. And it displays with timerIntervalSinceNow
.
The problem is when it reaches zero it should show zero to but that does not happen before clicking again on the screen. If I do not click on it it keeps going up since it is timeIntervalSinceNow
, but when I click it switches to the Text
with 0 sec
.
Any way on telling SwiftUI to do this by itself without clicking?
if(exerciseTime[value].timeIntervalSinceNow > 0) {
Text(exerciseTime[value], style:.relative).foregroundColor(.white).font(.largeTitle).padding(.top, 30)
} else {
Text("0 sec").foregroundColor(.white).font(.largeTitle).padding(.top, 30)
}