Created
January 14, 2020 20:47
-
-
Save giovani-pereira-ifood/34f436e4917a1415fcd3848cfd4a9107 to your computer and use it in GitHub Desktop.
Mirror example
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
struct Point { | |
let x: Int, y: Int | |
} | |
let p = Point(x: 21, y: 30) | |
let mirror = Mirror(reflecting: p) | |
print(mirror) // Mirror for Point | |
print(mirror.children.first) // Optional((label: Optional("x"), value: 21)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment