Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create GCD queue in Swift? [duplicate]

I get an crash when creating a GCD queue in Swift, any idea?

var q: dispatch_queue_t?
q = dispatch_queue_create("com.kukodajanos.queryPlaces", 0)

enter image description here

like image 247
János Avatar asked Dec 15 '22 15:12

János


2 Answers

By looking at the documentational comments for it by alt + click you can see:

Image

In the attr you can pass 3 things: nil, DISPATCH_QUEUE_SERIAL and DISPATCH_QUEUE_CONCURRENT not an Int.

like image 136
Arbitur Avatar answered Jan 01 '23 22:01

Arbitur


Pass nil instead of 0:

    var q: dispatch_queue_t?
    q = dispatch_queue_create("com.kukodajanos.queryPlaces", nil)
like image 31
Giordano Scalzo Avatar answered Jan 01 '23 21:01

Giordano Scalzo