How to create a serial DispatchQueue in swift 3 with Xcode 8 beta 4?

The following no longer works:

DispatchQueue(label: "Some Label", attributes: .serial)


The new DispatchQueue.Attributes does not contain a serial constant.


extension DispatchQueue {
    public struct Attributes : OptionSet {

        public let rawValue: UInt64

        public init(rawValue: UInt64)
        public static let concurrent: DispatchQueue.Attributes
        public static let initiallyInactive: DispatchQueue.Attributes

}


So how does one create a serial queue now?


Thanks!

I'm guessing Dispatche Queues are created with a serial attribute by default?

// This creates a serial queue?
DispatchQueue(label: "com.my.label")
Accepted Answer

Serial is the default. DispatchQueue.Attributes is an OptionSetType, but it doesn't make sense to include .serial as a member as [.serial, .concurrent] would make no sense. The abscence of the .concurrent attribute simply means it's serial 🙂


Source: https://github.com/apple/swift/pull/3927

For reference, here's another post regarding this same question: https://forums.developer.apple.com/message/159457

Same guess as mine and the swift-users message.

How to create a serial DispatchQueue in swift 3 with Xcode 8 beta 4?
 
 
Q