• 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: Strategy for acting on changes in child objects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strategy for acting on changes in child objects?


  • Subject: Re: Strategy for acting on changes in child objects?
  • From: Caleb Strockbine <email@hidden>
  • Date: Thu, 07 May 2009 04:39:14 -0400

On May 7, 2009, at 2:21 AM, Graham Cox <email@hidden> wrote:

A. each observable object class exports a list of properties that it
thinks may be of interest to an observer. This is just an array of
strings (property names) returned by a class method.

B. A utility method iterates over that list and registers a nominated
observer against each one. There is also a complementary de-observing
method.

C. The observer calls the utility method on the child passing itself
as an observer.

Isn't that pretty much what +keyPathsForValuesAffectingValueForKey: is for? The parent object could observe a single property, such as 'modified', and any children would implement either +keyPathsForValuesAffectingValueForKey: or +keyPathsForValuesAffectingModified to return the set of the properties that would cause a child to be treated as modified. No utility method needed -- KVO does it for you.


-Caleb
_______________________________________________

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


  • Follow-Ups:
    • Re: Strategy for acting on changes in child objects?
      • From: Seth Willits <email@hidden>
    • Re: Strategy for acting on changes in child objects?
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Help Making Shell Script Accept Spaces
  • Next by Date: Re: Dynamic Layout
  • Previous by thread: Re: Strategy for acting on changes in child objects?
  • Next by thread: Re: Strategy for acting on changes in child objects?
  • Index(es):
    • Date
    • Thread