Skip to content

Instantly share code, notes, and snippets.

@alladinian
Created July 9, 2013 08:39
Show Gist options
  • Save alladinian/5955702 to your computer and use it in GitHub Desktop.
Save alladinian/5955702 to your computer and use it in GitHub Desktop.
How to Execute Code Asynchronously (GCD)
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0ul);
dispatch_async(queue, ^{
// Perform async operation
dispatch_sync(dispatch_get_main_queue(), ^{
// Update UI
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment