📜  倒计时计时器快速堆栈溢出 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:59.184000             🧑  作者: Mango

代码示例1
var secondsRemaining = 60


Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(updateCounter), userInfo: nil, repeats: true)
}
@objc func updateCounter(){
    if secondsRemaining > 0 {
    print("\(secondsRemaining) seconds.")
    secondsRemaining -= 1
            }
        }