Skip to content

Instantly share code, notes, and snippets.

@patricklynch
Last active August 11, 2016 02:24
Show Gist options
  • Save patricklynch/ba961591dec8b3f78451 to your computer and use it in GitHub Desktop.
Save patricklynch/ba961591dec8b3f78451 to your computer and use it in GitHub Desktop.
GCD Shorthand
// Some short hand GCD to keep code cleaner
func dispatch_after( delay:Double, closure:()->() ) {
dispatch_after(
dispatch_time(
DISPATCH_TIME_NOW,
Int64(delay * Double(NSEC_PER_SEC))
),
dispatch_get_main_queue(), closure)
}
func dispatch_main( closure:()->() ) {
dispatch_async( dispatch_get_main_queue(), {
closure()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment