Question : waiting for all the threads to finish swift
Answered by : kanishk-dhindsa
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 : https://stackoverflow.com/questions/47041491/swift-wait-for-closure-thread-to-finish | Last Update : Sat, 04 Jun 22