MagicTimer
MagicTimer copied to clipboard
About countdown
There is an error in the countdown time return, and it does not stop when the time reaches completion。
func start() {
timer.countMode = .countDown(fromSeconds: 60)
timer.defultValue = 0
timer.effectiveValue = 1
timer.timeInterval = 1
timer.isActiveInBackground = true
// Set up event handlers
timer.lastStateDidChangeHandler = { state in
print("Timer state changed: \(state)")
}
timer.elapsedTimeDidChangeHandler = { elapsedTime in
print("Elapsed time updated: \(elapsedTime)")
}
// Start the timer
timer.start()
}