Skip to content

Instantly share code, notes, and snippets.

@alfredcc
Created November 8, 2015 14:03
Show Gist options
  • Save alfredcc/92d646f02892c97258d6 to your computer and use it in GitHub Desktop.
Save alfredcc/92d646f02892c97258d6 to your computer and use it in GitHub Desktop.
delay function in swift
// A delay function
func delay(seconds seconds: Double, completion:()->()) {
let popTime = dispatch_time(DISPATCH_TIME_NOW, Int64( Double(NSEC_PER_SEC) * seconds ))
dispatch_after(popTime, dispatch_get_main_queue()) {
completion()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment