Last active
December 17, 2017 15:56
-
-
Save kmkrn/892efe4d6f5996e5b87f88701bff1190 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
extension Pomsky: CustomReflectable { | |
var customMirror: Mirror { | |
return Mirror(Pomsky.self, children: ["name": self.breedName , "size": self.size, "type" : self.dogType], displayStyle: .class, ancestorRepresentation: .generated) | |
} | |
} | |
let pomsky = Pomsky() | |
let pomskyMirror = Mirror(reflecting: pomsky) | |
for case let (label?, value) in pomskyMirror.children { | |
print(label, value) | |
} | |
//prints | |
//name Pomsky | |
//size 2 | |
//type companion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment