ios - Swift 3 中的 "dispatch_apply"是什么?

标签 ios swift swift3

我一直在寻找 swift3 中 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")
}

关于ios - Swift 3 中的 "dispatch_apply"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39590128/

相关文章:

iOS Swift 低功耗蓝牙 : Discovering Multiple Characteristics within a Single Service

ios - Swift - 在阴影层中切孔

iOS 处理内存警告

ios - 未设置 prepareForSegue 目标 Controller 属性

ios - 从 Collection View 传递到 View Controller 的简单图像数据失败

core-data - Swift 3 中的新核心数据

swift - 从具有多个 child 的 Firebase 数据库中检索

iphone - iOS Dev : Why does self. navigationController.navigationBar.frame.size.height 返回零?

ios - 如果结果使用 NSLog 记录,如何创建单元测试

swift - Heroku:如何读取文件?