Created
June 23, 2014 17:15
-
-
Save Nub/638ca3ef0040136e5848 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
% xcrun swift 1 ↵ | |
Welcome to Swift! Type :help for assistance. | |
1> class Foo { | |
2. var num = 1 | |
3. var string = "String" | |
4. } | |
5> | |
6> reflect(Foo())[0] | |
$R1: (String, Mirror) = { | |
0 = "num" | |
1 = { | |
_value = 1 | |
summaryFunction = | |
quickLookFunction = | |
} | |
} | |
7> var numKey = reflect(Foo())[0].0 | |
numKey: String = "num" | |
8> var numContainer = reflect(Foo())[0].1 | |
numContainer: _LeafMirror<Int> = { | |
_value = 1 | |
summaryFunction = | |
quickLookFunction = | |
} | |
9> | |
10> var stringKey = reflect(Foo())[1].0 | |
stringKey: String = "string" | |
11> var stringContainer = reflect(Foo())[1].1 | |
stringContainer: _LeafMirror<String> = { | |
_value = "String" | |
summaryFunction = | |
quickLookFunction = | |
} | |
12> |
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
class Foo { | |
var num = 1 | |
var string = "String" | |
} | |
reflect(Foo())[0] | |
var numKey = reflect(Foo())[0].0 | |
var numContainer = reflect(Foo())[0].1 | |
var stringKey = reflect(Foo())[1].0 | |
var stringContainer = reflect(Foo())[1].1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment