Re: "Bindings"; Was: whether property in Cocoa class is KVO-compliant?
Re: "Bindings"; Was: whether property in Cocoa class is KVO-compliant?
- Subject: Re: "Bindings"; Was: whether property in Cocoa class is KVO-compliant?
- From: Mike Abdullah <email@hidden>
- Date: Mon, 11 Jan 2010 17:46:10 +0000
On 11 Jan 2010, at 17:01, Jerry Krinock wrote:
>
> On 2010 Jan 11, at 03:47, Quincey Morris wrote:
>
>> On Jan 10, 2010, at 19:58, Jerry Krinock wrote:
>>
>>> toObject:segmentedControl
>>
>> You *didn't* "bind an NSSegmentedControl to its window controller", you actually bound a window controller['s "foo" binding] to [the "selectedSegment" property of] a NSSegmentedControl.
>
> Oops, you're correct. Like the method says, bind:*to*:segmentedControl.
>
>> IIRC the bindings documentation isn't clear which direction "is bound to" refers to and/or it gives the impression that a binding is symmetric (which it may effectively be at the level of notifications, but it isn't at the level of establishing bindings between objects).
>
> When I first heard the word "binding", from other uses in English, I assumed that it was two-way, and labored under this incorrect assumption for quite awhile. Now I know that a binding is only one way, and further that change data flows in the *opposite* direction of the *to*. That is, if I bind myself *to* you, I observe what you do and your changes flow back *to* me.
>
> I wonder why bindings was not as an extension of KVO, instead of as a separate sideshow. The effect is the same as KVO, with the addition that a designated setter is automatically invoked in the observer when a change is observed.
What makes you say this? Bindings do work by using KVO. The default implementation calls -setValue:forKey: when it detects a change, but any object is free to handle a binding any way it likes. (Most of AppKit as far as I can tell uses a customised process that doesn't retain the target object)._______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden