Skip to content

Instantly share code, notes, and snippets.

@aybekckaya
Last active May 16, 2019 10:26
Show Gist options
  • Select an option

  • Save aybekckaya/b666ca14874787201976f246b2a4609d to your computer and use it in GitHub Desktop.

Select an option

Save aybekckaya/b666ca14874787201976f246b2a4609d to your computer and use it in GitHub Desktop.
let group:DispatchGroup = DispatchGroup()
group.enter() // entryCount = 1
iAmLongRunningFunc {
group.leave() // entryCount = 0
}
group.enter() // entryCount = 1
iAmLongRunningFunc {
group.leave() // entryCount = 0
}
group.notify(queue: DispatchQueue.main) {
// if entryCount is 0 , then you get notified.
print("All tasks completed . Get rest")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment