Created
December 17, 2017 16:07
-
-
Save kmkrn/226366a767eb4758fea787c757d3a24b 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
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