Created
June 6, 2016 09:55
-
-
Save fitomad/03c4110674c247fe5b5eef7758969dbd to your computer and use it in GitHub Desktop.
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
/** | |
Execute closure after a delay | |
- Parameters: | |
-delay: Time to wait until execute closure | |
- closure: What is going to be executed | |
*/ | |
public func delay(delay: Double, closure: () -> ()) | |
{ | |
let time_gcd: dispatch_time_t = dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))) | |
dispatch_after(time_gcd, dispatch_get_main_queue(), closure) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment