Skip to content

Instantly share code, notes, and snippets.

@aclissold
Created October 18, 2014 15:50
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 aclissold/c83f6740aecb6f866614 to your computer and use it in GitHub Desktop.
Save aclissold/c83f6740aecb6f866614 to your computer and use it in GitHub Desktop.
Convenience initializers in Swift
class Letter {
convenience init(filePath: String) {
self.init()
loadFromFile(filePath)
}
func loadFromFile(filePath: String) {
println("loading \(filePath)")
}
}
let letter1 = Letter()
letter1.loadFromFile("path")
let letter = Letter(filePath: "hello")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment