Skip to content

Instantly share code, notes, and snippets.

@zwaldowski
Created April 5, 2017 14:37
Show Gist options
  • Save zwaldowski/74dfd55a2f6ee9db5a28c2c6b25aed5b to your computer and use it in GitHub Desktop.
Save zwaldowski/74dfd55a2f6ee9db5a28c2c6b25aed5b to your computer and use it in GitHub Desktop.
class MyViewController: UIViewController {
var d1: String?
var d2: String? = "foo"
}
let vc = MyViewController()
Array(Mirror(reflecting: vc).children) /* => [
(label: "d1" as String?, value: Optional.none as Any),
(label: "d2" as String?, value: Optional.some("foo") as Any),
]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment