• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: KVO one-step listening but two-step notifying?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVO one-step listening but two-step notifying?


  • Subject: Re: KVO one-step listening but two-step notifying?
  • From: Scott Anguish <email@hidden>
  • Date: Fri, 23 Dec 2005 10:05:48 -0500


On Dec 23, 2005, at 9:23 AM, Daniel Jalkut wrote:

Thanks! I guess it makes sense now.

Is it worth questioning *which* components of bindings rely on the old value?

I think all that you can currently count on (which is documented in the flow charts in the bindings doc) is that when change notifications go from a controller to a view item, that the view explicitly asks for the current value, rather than pulling it from the change notification directly.


Looking at the KVO docs, I could imagine deciding (if I was implementing all aspects of notifier and observed) for a particular key that it's "OK" for it not to have an old value. This would be in exchange for writing observer methods that either don't subscribe to or disregard the NSKeyValueChangeOldKey.

I think at the KVO level, it's best to provide it all... a particular observation receiver can then determine its best course of action (use the change value, or ask for the current value via KVC.


I suppose once any "pre-fab" Apple bindings are introduced it's risky business to assume whether they do or don't depend on the "old value," but for instance I could imagine feeling pretty safe about binding a single boolean value to a checkbox with disregard for the "old value". Would even that be foolish?

Daniel

On Dec 23, 2005, at 4:21 AM, mmalcolm crawford wrote:

I'm assuming that *both* in the second essentially means "will/ didChange". If it's OK to do when nothing has happened, how can it be wrong (dangerous, not just inefficient) to do so some time after a change has already occurred? Isn't that the same (safety- wise) as "nothing has happened"?

No, because a change has actually happened in the second case, and the KVO machinery may need the old value to calculate a delta. Some parts of bindings *require* the old and new values...
(See <http://developer.apple.com/documentation/Cocoa/Reference/ Foundation/ObjC_classic/Protocols/NSKeyValueObserving.html#// apple_ref/doc/c_ref/NSKeyValueChangeKindKey>.)


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >KVO one-step listening but two-step notifying? (From: Hamish Allan <email@hidden>)
 >Re: KVO one-step listening but two-step notifying? (From: mmalcolm crawford <email@hidden>)
 >Re: KVO one-step listening but two-step notifying? (From: Daniel Jalkut <email@hidden>)
 >Re: KVO one-step listening but two-step notifying? (From: mmalcolm crawford <email@hidden>)
 >Re: KVO one-step listening but two-step notifying? (From: Daniel Jalkut <email@hidden>)
 >Re: KVO one-step listening but two-step notifying? (From: mmalcolm crawford <email@hidden>)
 >Re: KVO one-step listening but two-step notifying? (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Does NSButton wrap long titles?
  • Next by Date: Re: How Does NSTableView/NSOutlineView reload automatically when they become visible on Screen
  • Previous by thread: Re: KVO one-step listening but two-step notifying?
  • Next by thread: Re: KVO one-step listening but two-step notifying?
  • Index(es):
    • Date
    • Thread