在Swift 2中,我能够dispatch_after使用大中央调度来延迟一个动作:
var dispatchTime: dispatch_time_t = dispatch_time(DISPATCH_TIME_NOW, Int64(0.1 * Double(NSEC_PER_SEC)))
dispatch_after(dispatchTime, dispatch_get_main_queue(), {
// your function here
})
Run Code Online (Sandbox Code Playgroud)
但这似乎不再在Swift 3(或4)中编译.在Swift 3中使用新的Dispatch API编写它的首选方法是什么?
在Swift 2中,我能够使用以下代码创建队列:
let concurrentQueue = dispatch_queue_create("com.swift3.imageQueue", DISPATCH_QUEUE_CONCURRENT)
Run Code Online (Sandbox Code Playgroud)
但这不能在Swift 3中编译.
在Swift 3中写这个的首选方法是什么?