• 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: Question about notifying KVO observers of changes to a property.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about notifying KVO observers of changes to a property.


  • Subject: Re: Question about notifying KVO observers of changes to a property.
  • From: Morales Vivó Óscar <email@hidden>
  • Date: Fri, 22 May 2009 11:12:37 -0400

That's looks like the most sensible solution. Thanks for the insight.


Another approach is to make your Objective-C wrapper duplicate the data of the C++ object, rather than being a pass-through wrapper. So, the getter for the property on your Objective-C wrapper does _not_ call through to C++ object to get the current value. Instead, it returns a cached value. Since your C++ code apparently already provides a post-change notification (or can easily be made to do so), your Objective-C code would only change its cached copy when it receives that notification. At that time, it can use a standard KVO- compliant setter to change its cached copy of the property value, or it can do willChange..., update the cache, didChange...

Regards,
Ken


_______________________________________________

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


References: 
 >Question about notifying KVO observers of changes to a property. (From: Morales Vivó Óscar <email@hidden>)
 >Re: Question about notifying KVO observers of changes to a property. (From: Peter Duniho <email@hidden>)
 >Re: Question about notifying KVO observers of changes to a property. (From: Morales Vivó Óscar <email@hidden>)
 >Re: Question about notifying KVO observers of changes to a property. (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Localizing absolute file name in Cocoa
  • Next by Date: NSPredicateEditorRowTemplate, NSPopupButton and bindings
  • Previous by thread: Re: Question about notifying KVO observers of changes to a property.
  • Next by thread: Re: Question about notifying KVO observers of changes to a property.
  • Index(es):
    • Date
    • Thread