Skip to content

Instantly share code, notes, and snippets.

@fredriccliver
Created March 14, 2021 16:18
Show Gist options
  • Save fredriccliver/c03f1a7ea726a627ff578bd2a5b213f2 to your computer and use it in GitHub Desktop.
Save fredriccliver/c03f1a7ea726a627ff578bd2a5b213f2 to your computer and use it in GitHub Desktop.
let asyncQueue = DispatchGroup()
for person in people{
asyncQueue.enter()
// "checkIdentity" is a Async function which takes networking resource and consume a bit of time.
self.checkIdentity(person) { (err) in
if(err != nil){
print(err)
}
asyncQueue.leave()
}
}
asyncQueue.notify(queue: .main) {
self.sendAllPeople()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment