Skip to content

Instantly share code, notes, and snippets.

@kmikael
Created June 13, 2014 15:06
Show Gist options
  • Save kmikael/faf11ed5d1a3b27c3c6f to your computer and use it in GitHub Desktop.
Save kmikael/faf11ed5d1a3b27c3c6f to your computer and use it in GitHub Desktop.
Update `dispatch_async` to take a default `queue`
import Dispatch
func dispatch_async(queue: dispatch_queue_t = dispatch_get_main_queue(), block: dispatch_block_t) {
Dispatch.dispatch_async(queue, block)
}
dispatch_async {
// Update the UI
}
// Alternatively, a less "hacky" solution
func async_main(block: dispatch_block_t) {
dispatch_async(dispatch_get_main_queue(), block)
}
async_main {
// Update the UI
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment