1

I added the Text(Date().addingTimeInterval(2400), style: .timer) in my Live Activity, but when its countdown to zero and the notification hasn't been delivered yet it starts to count up.

Is it can be fixed?

I tried to use the normal Timer but in the Live Activity it doesn't work

Empiric10
  • 25
  • 5

1 Answers1

4

Use this initializer instead: https://developer.apple.com/documentation/swiftui/text/init(timerinterval:pausetime:countsdown:showshours:)

So in your case:

let range = Date()...Date().addingTimeInterval(2400)

Text(
   timerInterval: range,
   pauseTime: range.lowerBound
)
Heikki Hautala
  • 491
  • 4
  • 5
  • Oh, thank you, I do not know why, but at first this option did not work for me, maybe the pause time was set incorrectly – Empiric10 Jan 09 '23 at 12:35