Created
November 8, 2015 14:03
-
-
Save alfredcc/92d646f02892c97258d6 to your computer and use it in GitHub Desktop.
delay function in swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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