📜  快速等到条件为真 - Swift 代码示例

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

代码示例1
//You can use a Timer
//You have to import Foundation first though

let timer = Timer.scheduledTimer(withTimeInterval: 5.0, repeats: false) { (timer) in
    //Code to run
}

//This makes it so that the code inside of the timer runs 5 seconds after loading, and it does not repeat
//More examples to be found at source, this is just one that I sort of prefer