-1

I have a live activity with a timer and when isLuminanceReduced is true, the timer rounds down.

How do I get my live activity to stay at 40:00 when the timer is paused at 40:00 instead of 39:--

struct TimerTextView: View {
    let range = Date()...Date().addingTimeInterval(1800)
    
    var body: some View {
        Text(timerInterval: range, pauseTime: range.upperBound)
    }
}

Display on 1 Luminance reduced 2

sfung3
  • 2,227
  • 1
  • 9
  • 30
  • two `Date()` you're using when initial the range are not the same date. try `let date = Date(); let range = date...date.addingTimeInterval(1800)` – Quang Hà May 08 '23 at 23:55
  • that was an intersting idea but unfortunately it did not work. – sfung3 May 10 '23 at 02:23

1 Answers1

0

does this work?


    struct TimerTextView: View {
        let range = Date()...Date().addingTimeInterval(1800)
        let pauseTime = Date().addingTimeInterval(1800).rounded(.up, toNearest: 60) //Round up to the nearest minute
        
        var body: some View {
            Text(timerInterval: range, pauseTime: pauseTime)
        }
    }

if it won't, maybe you had any writing mistakes?

  • i'm not sure what `.rounded(.up, toNearest: 60)` is but in theory this works but i'd like to pause my timer whenever, not just to the nearest minute. – sfung3 May 10 '23 at 02:26