Skip to content

Instantly share code, notes, and snippets.

@robertmryan
Last active November 26, 2019 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertmryan/4e4f52dcb4222db4b5ec777d824db549 to your computer and use it in GitHub Desktop.
Save robertmryan/4e4f52dcb4222db4b5ec777d824db549 to your computer and use it in GitHub Desktop.
let group = DispatchGroup()
for album in albums {
let formattedAlbum = AlbumFormatted(context: self.persistenceManager.context)
formattedAlbum.albumName = album.name
group.enter()
self.getTracklist(album: album.id!) { data in
// do whatever you need to add this `data` to your temporary result set
group.leave()
}
}
group.notify(queue: .main) {
// now everything should be there
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment