Skip to content

Instantly share code, notes, and snippets.

@sinsoku
Created June 15, 2016 17:27
Show Gist options
  • Select an option

  • Save sinsoku/5dc01e99ff575e2de4009a17746ce7e7 to your computer and use it in GitHub Desktop.

Select an option

Save sinsoku/5dc01e99ff575e2de4009a17746ce7e7 to your computer and use it in GitHub Desktop.
mirror sample
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