Swift 4实现延时的简单方法:
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) {
// Code
}
Swift 5实现延时的简单方法:
DispatchQueue.main.asyncAfter(deadline: .now() + 2, execute: {
// code to execute
})
Swift 4实现延时的简单方法:
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) {
// Code
}
Swift 5实现延时的简单方法:
DispatchQueue.main.asyncAfter(deadline: .now() + 2, execute: {
// code to execute
})