In swift 1.2, create a dispatch queue just like this:
dispatch_queue_create("imageProcessingQueue", DISPATCH_QUEUE_SERIAL)
But in swift 2.0, it has an error:
Cannot invoke 'dispatch_queue_create' with an argument list of type '(String, dispatch_queue_attr_t!)'
dispatch_queue_create
want an UnsafePointer<Int8>
type, how can I get that.
I had this issue too, when assigning to a lazy var
. I was able to bypass the error by explicitly adding a type to my variable:
lazy var myQueue: dispatch_queue_t = dispatch_queue_create("imageProcessingQueue", DISPATCH_QUEUE_SERIAL)
The error message is confusing. Most likely it originates from some code surrounding (most likely immediately preceding) this code.
To verify, create a new Playground and run this - it compiles without errors:
import Foundation
let queue = dispatch_queue_create("label", DISPATCH_QUEUE_SERIAL)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With