4
我一直在swift3中搜索等效的dispatch_apply。请帮助我Swift 3中的“dispatch_apply”相当于什么?
转换
let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_apply(2, queue) { (index) in
}
我一直在swift3中搜索等效的dispatch_apply。请帮助我Swift 3中的“dispatch_apply”相当于什么?
转换
let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_apply(2, queue) { (index) in
}
你还记得dispatch_apply()。那么,它仍然在那里,并得到一个新的名字。从现在开始,你必须调用concurrentPerform()
改变这种
dispatch_apply(2, queue) { (index) in
}
到
DispatchQueue.concurrentPerform(iterations: 2) {
print("\($0). concurrentPerform")
}
'DispatchQueue.concurrentPerform(迭代:' – Khundragpan