Skip to content

Instantly share code, notes, and snippets.

@blasten
Created January 6, 2015 18:40
Show Gist options
  • Save blasten/a703ce3a47eb25cf95dc to your computer and use it in GitHub Desktop.
Save blasten/a703ce3a47eb25cf95dc to your computer and use it in GitHub Desktop.
Managing threads in swift using Grand Central Dispatch
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
// I'm the background thread
dispatch_async(dispatch_get_main_queue()) {
// I'm the UI thread
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment