Skip to content

Instantly share code, notes, and snippets.

@victoraugustolls
Last active June 11, 2016 20:07
Show Gist options
  • Save victoraugustolls/5b9d073b063acdae1fe37b2fd8efdd6e to your computer and use it in GitHub Desktop.
Save victoraugustolls/5b9d073b063acdae1fe37b2fd8efdd6e to your computer and use it in GitHub Desktop.
public extension dispatch_queue_t {
final func async(block: dispatch_block_t) {
dispatch_async(self, block)
}
final func async(group: dispatch_group_t, _ block: dispatch_block_t) {
dispatch_group_async(group, self, block)
}
final func sync(block: dispatch_block_t) {
dispatch_sync(self, block)
}
}
// Usage like dispatch_get_main_queue().async { /* do stuff async */ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment