📜  使用定时器 swift 代码示例

📅  最后修改于: 2022-03-11 15:01:02.579000             🧑  作者: Mango

代码示例1
Timer.scheduledTimer(timeInterval: 1, 
    target: self, 
    selector: #selector(YourController.update), 
    userInfo: nil, 
    repeats: true)

// @objc selector expected for Timer
@objc func update() {
    // do what should happen when timer triggers an event
}