Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

waiting for all the threads to finish swift

let group = DispatchGroup()
group.enter()
DispatchQueue.global(qos: .userInitiated).async {
    // Do work asyncly and call group.leave() after you are done
    group.leave()
}
group.notify(queue: .main, execute: {
    // This will be called when block ends             
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #waiting #threads #finish #swift
ADD COMMENT
Topic
Name
7+1 =