Skip to content

Instantly share code, notes, and snippets.

@JaNd3r
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JaNd3r/5f39fbe6980aae2266d7 to your computer and use it in GitHub Desktop.
Save JaNd3r/5f39fbe6980aae2266d7 to your computer and use it in GitHub Desktop.
Loosely collection of Swift snippets...
// 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