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