Hi There,

So I recently updated my Xcode and I am now using Swift 3. I used to make my dispatch queues in Swift like so:

dispatch_async(dispatch_get_main_queue()) {
     print("Main thread")

However, now when I do it, I get this error:


‘dispatch_async’ has been replaced by instance method ‘DispatchQueue.asynchronously(execute:)’


Ok, so that’s the answer you say. Then I click the error icon and click fix it. Which changed the code to this:


Which then throws this error:


‘dispatch_async’ has been replaced by instance method ‘DispatchQueue.asynchronously(execute:)’


The Same one? I click the fix again. Which changes the code to:


Which now gives this error:


Value of type ‘DispatchQueue’ has no member ‘asynchronously’


I am confused about how to make this work for Swift 3. Can someone please show me how to Create Dispatch Queues in Swift 3?


Thank yo in advance ya’ll. Much appreciated

iOS-Blog Admin Team answered