Skip to content

Instantly share code, notes, and snippets.

@tsraveling
Created April 18, 2017 23:58
Show Gist options
  • Save tsraveling/9a8cf3ae46abfff1034e09a3cf09aacb to your computer and use it in GitHub Desktop.
Save tsraveling/9a8cf3ae46abfff1034e09a3cf09aacb to your computer and use it in GitHub Desktop.
Async call
// Do this next part in the background
DispatchQueue.global(qos: .userInitiated).async {
// Do your time-costly work here
// Return to the main thread to update the UI
DispatchQueue.main.async {
// Perform UI updates here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment