Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import Foundation
  2.  
  3. func delay(delay:Double, closure:()->()) {
  4. dispatch_after(
  5. dispatch_time(
  6. DISPATCH_TIME_NOW,
  7. Int64(delay * Double(NSEC_PER_SEC))
  8. ),
  9. dispatch_get_main_queue(), closure)
  10. }
  11.  
  12. func async(closure:()->()) {
  13. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), closure)
  14. }
  15.  
  16. func main(closure:()->()) {
  17. dispatch_async(dispatch_get_main_queue(), closure)
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement