Re: Core Data: Custom to-many relationship setter not being invoked
Re: Core Data: Custom to-many relationship setter not being invoked
- Subject: Re: Core Data: Custom to-many relationship setter not being invoked
- From: Kyle Sluder <email@hidden>
- Date: Tue, 23 Feb 2010 14:52:32 -0800
On Tue, Feb 23, 2010 at 2:32 PM, Jerry Krinock <email@hidden> wrote:
> Furthermore, I've never been able to find any documentation stating that Cocoa is required to invoke the set mutator method(s). Invoking the setEmployees: method, which both Ken and I have noted *does* happen, is a KVC-compliant technique. So, I'm not sure that it's a bug.
Not quite. KVC compliance refers to implementing the proper methods
such that -setValue:forKey:, -valueForKey: and
-mutable(Set|Array)ValueForKey: work. It doesn't refer to how one
modifies that property. So it doesn't make sense to say that "calling
-setEmployees: is KVC-compliant." In fact, according to the Accessor
Search Implementation Details, you don't need to implement -set<Key>:
at all. It just so happens that Core Data gives you an implementation
that doesn't do what you need to do, and KVC uses it when convenient.
The real bug is that NSArrayController doesn't use the fast-path KVC
methods for updating the target of its contentSet binding, which is
what exposes the need to override -set<Key>: in this situation.
--Kyle Sluder
_______________________________________________
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