[swift-evolution] SE-0062 Referencing Objective-C key-paths

Les Pruszynski lpruszynski at gmail.com
Thu Apr 7 23:34:31 CDT 2016


This is my first post on this list so please bear with me.

I very much like this proposal but what bothers me is this doubling of valueForKeyPath(#keyPath(xxx) in the signature of the function.

chris.valueForKeyPath(#keyPath(Person.bestFriend.lastName)) // => Groff
chris.valueForKeyPath(#keyPath(Person.friends.firstName)) // => ["Joe", "Douglas"]

I’m not sure whether the form below is actually possible. For me it reads more naturally and is more consistent with “Modern Swift” as far as I know.

chris.valueFor(#keyPath(Person.friends.firstName)) // => ["Joe", "Douglas”]
or maybe
chris.valueOf(#keyPath(Person.friends.firstName)) // => ["Joe", "Douglas”]

Just my observation.
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160408/7f078e7a/attachment.html>


More information about the swift-evolution mailing list