Re: Custom Accessors in Core Data
Re: Custom Accessors in Core Data
- Subject: Re: Custom Accessors in Core Data
- From: Jerry Krinock <email@hidden>
- Date: Wed, 2 Feb 2011 20:21:12 -0800
On 2011 Feb 02, at 12:51, Quincey Morris wrote:
> I don't believe there's any real difficulty about writing the accessors as such.
Agreed; I've added such "value accessors" with no trouble.
> If you make *only* a getter for the "...Num" version, then I think it's easy -- you just make it a dependent key via 'keyPathsForValuesAffecting...'.
But I'd say you need to do it the other way around, since the Num/object version is the "primitive" which is stored in the data model by Core Data. The scalar accessor should depend on the Num/object accessor.
> If you try to make a setter too, then it gets harder to make sure you don't generate too many KVO notifications
Similarly, the scalar setter should invoke the "primitive" Num/object accessor.
On 2011 Feb 02, at 12:16, Sean McBride wrote:
> Use mogenerator. It creates scalar accessors for you…
Yes, I've used mogenerator for new projects, but, you know, for little changes I just write the code by hand … faster to grab a pair of pliers from the kitchen drawer rather than going out to the garage to get a socket wrench. But Gordon, you should try mogenerator and see if the code it generates is as I described above.
_______________________________________________
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