Re: Question about notifying KVO observers of changes to a property.
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