Created
October 18, 2014 15:50
-
-
Save aclissold/c83f6740aecb6f866614 to your computer and use it in GitHub Desktop.
Convenience initializers in Swift
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
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