4 ms·
The key path snippet is not a good example. The real value of key path is nested structures.
by zyang 7y ago
The key path snippet is not a good example. The real value of key path is nested structures.
- jmull 7y agoWell, what is a good example? The proposal doesn't seem to have one. https://github.com/apple/swift-evolution/blob/master/proposals/0249-key-path-literal-function-expressions.md https://github.com/apple/swift-evolution/blob/master/proposa...
- zyang 7y agoSee last example. https://medium.com/joshtastic-blog/swift-keypaths-ea5a1ec880e9 https://medium.com/joshtastic-blog/swift-keypaths-ea5a1ec880...
- jmull 7y agoI mean an example of why this new language feature -- the ability to implicitly treat a keypath as a function -- is useful. (The last example in your link shows using a keypath to specify a sort criteria. That's a nice use of keypaths, but isn't helped by this new feature.)