Last active
February 28, 2016 23:17
-
-
Save robertmryan/658b00944427e8601aff to your computer and use it in GitHub Desktop.
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
// original class | |
class A { | |
var x: String | |
init(x: String) { | |
self.x = x | |
} | |
} | |
// new class | |
class A { | |
var x: String | |
var y: String | |
init(x: String, y: String = "bar") { | |
self.x = x | |
self.y = y | |
} | |
} | |
// that way, this still works: | |
let a = A(x: "foo") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment