[swift-corelibs-dev] NSKeyValueCoding and the Swift Foundation

Tony Parker anthony.parker at apple.com
Sun Jun 26 13:27:53 CDT 2016


Hi Lars,

Unfortunately, I don’t think there is anything planned for Swift 3 in this area. Beyond that we just don’t have any concrete information yet.

This is a pretty big topic, so it’s likely we’ll need to have some extended design discussions about what reflection or runtime dynamism in general looks like in Swift in the future. KVO/KVC take advantage of a huge number of dynamic ObjC features, and Mirror is not even remotely capable of most of it right now. Mirrors were designed for debugging support.

- Tony


> On Jun 25, 2016, at 6:27 AM, Lars Sonchocky-Helldorf via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> 
> To my understanding the real reason why this is currently not possible is rooted in the limitations of struct Mirror, which, for instance, lacks the support for writing and the reflection of methods.
> 
> So it boils down to the following: Are there currently any plans to extend the capabilities of struct Mirror to support better reflection?
> 
> 
> Trying to answer this question I found this post: 
> 
> https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20151214/000512.html
> 
> where Joe Groff says there is something planned.
> 
> 
> Are there any news on this, maybe a rough timeframe or Swift version for which to expect better reflection support?
> 
> 
> Thanks,
> 
> 	Lars
> 
>> Am 12.06.2016 um 20:40 schrieb Philippe Hausler <phausler at apple.com>:
>> 
>> Both KVC and KVO require dynamic dispatching and selector manipulation that is not present in swift-corelibs-foundation (since everything is based on swift objects).
>> 
>>> On Jun 12, 2016, at 10:54 AM, Lars Sonchocky-Helldorf via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
>>> 
>>> Hi everybody,
>>> 
>>> it came to my attention that the NSKeyValueCoding protocol which is a part of the Darwin-(ObjC-)Foundation (see https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueCoding_Protocol/ ) is somehow omitted here: https://github.com/apple/swift-corelibs-foundation/blob/master/Docs/Status.md
>>> 
>>> Was this done on purpose or is the implementation of NSKeyValueCoding still forthcoming?
>>> 
>>> Thanks,
>>> 
>>> 	Lars
>>> 
>>> 
>>> _______________________________________________
>>> swift-corelibs-dev mailing list
>>> swift-corelibs-dev at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
>> 
> 
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev



More information about the swift-corelibs-dev mailing list