How to create dispatch queue in Swift?

This tutorial for queue operation and how it's works.


Create Concurrent Queue:
let concurrentQueue = DispatchQueue(label: "queue-name", attributes: .concurrent)
concurrentQueue.sync {

}
Create Serial Queue:
let serialQueue = DispatchQueue(label: "queue-name")
serialQueue.sync { 

}
Create Main Queue Async:
DispatchQueue.main.async {

}
Create Main Queue Sync:
DispatchQueue.main.sync {

}
Create Background Thread:
DispatchQueue.global(qos: .background).async {

}
Call After a second:
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1000)) {
   // Code
}

Send comment for any more updates.

Thanks.
How to create dispatch queue in Swift? How to create dispatch queue in Swift? Reviewed by KIRIT MODI on 21:42:00 Rating: 5

No comments:

Powered by Blogger.