Created
January 19, 2017 23:24
-
-
Save macrael/615987684c90635c77f3df04c45a0f99 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 FooClass { | |
| var name: String = "" { | |
| didSet(newName) { | |
| print("SET") | |
| print(newName) | |
| } | |
| } | |
| func changeAName(inout theProp: String) { | |
| theProp = "jazzhands" # Changes the value of name but doesn't call the setter | |
| } | |
| func chagngeit() { | |
| self.changeAName(&self.name) | |
| } | |
| } | |
| let f = FooClass() | |
| f.name = "jazzersize" # calls the setter correctly | |
| f.name # "jassersize" | |
| f.chagngeit() | |
| f.name # "jazzhands" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment