Created
November 27, 2014 16:42
-
-
Save jeden/24d31d933851c133f038 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 SomeClass { | |
var _optionalVar: String? | |
var nonoptionalVar: String? { | |
get { return _optionalVar } | |
set { _optionalVar = newValue == nil ? "123" : newValue } | |
} | |
init() { | |
self.nonoptionalVar = nil | |
} | |
} | |
let instance = SomeClass() | |
instance.nonoptionalVar | |
instance.nonoptionalVar = nil | |
instance.nonoptionalVar | |
instance.nonoptionalVar = "newvalue" | |
instance.nonoptionalVar = nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment