Created
February 3, 2026 13:45
-
-
Save pookjw/5863bd129d97db9142324d7c305ea71a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 MyDef { | |
| subscript(value: Int) -> Int { | |
| return value | |
| } | |
| } | |
| let def = MyDef() | |
| let keyPath: KeyPath<MyDef, Int> = \MyDef.[3] | |
| print(def[keyPath: keyPath]) // 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment