[swift-evolution] Swift-Native Alternative to KVO
clattner at apple.com
Fri Jan 1 22:32:52 CST 2016
On Jan 1, 2016, at 5:00 PM, Jared Sinclair via swift-evolution <swift-evolution at swift.org> wrote:
> The one-to-many observer pattern could really use a first-party, native Swift solution. The day-to-day practice of writing iOS / OS X applications needs it, and we end up falling back on antiquated APIs like KVO or NSNotificationCenter, or short-lived third-party libraries. This is an essential need that deserves a fresh approach.
I agree with your motivation, but I can’t see us having time to take this on in the Swift 3 timeframe. There is a huge potential design space here, and KVO has some significant sub-optimalities in its design - only one of which is that notifications often get delivered on the “wrong” thread.
It is pretty likely that we’ll get property behaviors in the Swift 3 timeframe, and that may enable some KVO like systems to be built. However, I doubt we would standardize and include a KVO system in the Swift 3 timeframe because of the short timeframes involved. Also, I’m very hopeful that we’ll be able to tackle concurrency in Swift 4, and making these two features mesh well seems really important.
That said, feel free to start hacking on the compiler to prototype your ideas!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution