Last active
August 29, 2015 14:25
-
-
Save JaNd3r/5f39fbe6980aae2266d7 to your computer and use it in GitHub Desktop.
Loosely collection of Swift snippets...
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
// SwingUtilities.invokeLater ;-) | |
func invokeLater(delay: CGFloat, code: () -> Void) { | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(delay * CGFloat(NSEC_PER_SEC))), dispatch_get_main_queue(), code) | |
} | |
// Usage: | |
invokeLater(0.1) { | |
doSomething() | |
} | |
// Documents Directory in Simulator | |
println("Documents Directory: \(NSFileManager.defaultManager().URLsForDirectory(NSSearchPathDirectory.DocumentDirectory, inDomains: NSSearchPathDomainMask.UserDomainMask))") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment