Last active
October 11, 2015 01:36
-
-
Save Reflejo/21b9fe4be65a69f9d8f9 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
protocol SomeProtocol { | |
var a: Int { get } | |
} | |
struct SomeStruct: SomeProtocol { | |
var a = 0 | |
} | |
class SomeClass { | |
var value: SomeProtocol = SomeStruct() { | |
didSet { print("Setter called.") } | |
} | |
func doSomething() { | |
print("About to do something") | |
_ = self.value.a | |
print("Did something") | |
} | |
} | |
SomeClass().doSomething() | |
// Output: | |
// | |
// About to do something | |
// Setter called. | |
// Did something |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment