En attendant que tous les fils finissent rapidement

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             
})
Kanishk Dhindsa