Skip to content

Instantly share code, notes, and snippets.

@axldyb
Created October 30, 2012 09:37
Show Gist options
  • Save axldyb/3979272 to your computer and use it in GitHub Desktop.
Save axldyb/3979272 to your computer and use it in GitHub Desktop.
Background queue block using GCD to create a thread for us
dispatch_queue_t mainQueue = dispatch_get_main_queue();
dispatch_queue_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(backgroundQueue,^{
// Do magical stuff in the background
dispatch_async(mainQueue,^{
// Update UI in the main thread
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment