On Nov 16, 2012, at 9:29 AM, davel...@mac.com wrote:

> 
> On Nov 15, 2012, at 8:22 PM, Rick Mann wrote:
> 
>> 
>> On Nov 15, 2012, at 17:04 , Kyle Sluder <k...@ksluder.com> wrote:
>> 
>>> Override -didChangeValueForKey:?
>> 
>> Apparently we are strongly discouraged from overriding those methods. :-)
>> 
>> -- 
>> Rick
> 
> Is this documented? What would be wrong with overriding it, calling [super 
> didChangeValueForKey:] and then doing whatever else you need to do?

>From the NSManagedObject docs:

> As with any class, you are strongly discouraged from overriding the key-value 
> observing methods such as willChangeValueForKey: and 
> didChangeValueForKey:withSetMutation:usingObjects:. 


Two theories as to why:

- People might forget to call super.
- KVO checks to see if -didChangeValueForKey: is overridden, and if not it 
calls the IMP directly, bypassing ObjC message dispatch.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to