在Swift 2中,我能够使用以下代码创建队列:
let concurrentQueue = dispatch_queue_create("com.swift3.imageQueue", DISPATCH_QUEUE_CONCURRENT)
Run Code Online (Sandbox Code Playgroud)
但这不能在Swift 3中编译.
在Swift 3中写这个的首选方法是什么?
在早期版本的Swift中,可以使用以下代码创建延迟:
let time = dispatch_time(dispatch_time_t(DISPATCH_TIME_NOW), 4 * Int64(NSEC_PER_SEC))
dispatch_after(time, dispatch_get_main_queue()) {
//put your code which should be executed with a delay here
}
Run Code Online (Sandbox Code Playgroud)
但现在,斯威夫特3时,Xcode自动改变6个不同的东西,但随后出现以下错误:"无法转换DispatchTime.now到预期值dispatch_time_t又名UInt64".
如何在Swift 3中运行一系列代码之前创建延迟?