Skip to content

Instantly share code, notes, and snippets.

@JaNd3r JaNd3r/HandySnippets.swift
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.