Created
June 15, 2016 17:27
-
-
Save sinsoku/5dc01e99ff575e2de4009a17746ce7e7 to your computer and use it in GitHub Desktop.
mirror sample
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 Foo { | |
| let number: Int? = nil | |
| } | |
| let m = Mirror(reflecting: Foo()) | |
| let defNumber = m.children.filter { $0.label == "number" }[0] | |
| defNumber.value == nil | |
| // Playground execution failed: MyPlayground.playground:1:17: error: value of type 'Any' (aka 'protocol<>') can never be nil, comparison isn't allowed | |
| // defNumber.value == nil | |
| //~~~~~~~~~~~~~~~ ^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment