How to stop live activity time from rounding down

379 Views Asked by At

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

1

There are 1 best solutions below

1
On

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?