【发布时间】:2016-10-14 19:47:01
【问题描述】:
在 Swift 2 中,我可以使用以下代码创建队列:
let concurrentQueue = dispatch_queue_create("com.swift3.imageQueue", DISPATCH_QUEUE_CONCURRENT)
但这在 Swift 3 中无法编译。
在 Swift 3 中编写此代码的首选方式是什么?
【问题讨论】:
-
Swift 4 有 3 个额外的参数来创建一个串行队列。如何使用它们来创建串行队列? DispatchQueue.init(label: , qos: , attributes: , autoreleaseFrequency: , target: )
-
@nr5 队列默认是串行的,所以只使用
DispatchQueue(label: "your-label")作为串行队列就足够了。额外的参数都有默认值。
标签: ios swift3 xcode8 grand-central-dispatch dispatch-after