Last active
June 9, 2016 11:31
-
-
Save akimach/7c003a50718c8ee1c98a158afc7d8e2c to your computer and use it in GitHub Desktop.
N秒後に処理を実行する
This file contains hidden or 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
| // n秒後に与えられた処理を行う | |
| func execAfterSec(n: Double, completion: (()->())?) { | |
| let delay = 1.0 * Double(NSEC_PER_SEC) | |
| let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay)) | |
| dispatch_after(time, dispatch_get_main_queue(), { | |
| completion!() | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment