iosswiftgrand-central-dispatchswift3

Type 'DispatchQueue.Attributes' has no member 'serial'


I have converted existing Swift2.3 code to Swift3.0 using Xcode8 beta4. Xcode automatically convert syntax to Swift3.0, but it not able to create serial dispatch queue.

private let serialQueue = DispatchQueue(label: "identifier", qos: DispatchQueue.Attributes.serial)


Solution

  • There is not .serial attribute anymore, but dispatch queues are by default serial, unless you specify the .concurrent attribute:

    let serialQueue = DispatchQueue(label: "label")
    let concurrentQueue = DispatchQueue(label: "label", attributes: .concurrent)
    

    Source: How to create a serial DispatchQueue in swift 3 with Xcode 8 beta 4? in the Apple Developer Forum.