• 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: Custom Accessors in Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: Custom Accessors in Core Data (From: Gordon Apple <email@hidden>)
 >Re: Custom Accessors in Core Data (From: Quincey Morris <email@hidden>)

  • Prev by Date: Which is the lightest way to draw images and text?
  • Next by Date: Re: Reusable Cells
  • Previous by thread: Re: Custom Accessors in Core Data
  • Next by thread: Re: Custom Accessors in Core Data
  • Index(es):
    • Date
    • Thread