Skip to content

Instantly share code, notes, and snippets.

@kmkrn
Created December 17, 2017 16:07
Show Gist options
  • Save kmkrn/226366a767eb4758fea787c757d3a24b to your computer and use it in GitHub Desktop.
Save kmkrn/226366a767eb4758fea787c757d3a24b to your computer and use it in GitHub Desktop.
let children = ownerMirror.children
for child in children {
if child.label == "dog" {
let grandChildren = Mirror(reflecting: child.value).children
Mirror(reflecting: child.value).children
for grand in grandChildren {
if grand.label == "breedName" {
print("Pete owns a \(grand.value)")
}
}
}
}
//prints
//Pete owns a Husky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment