From the Core Data Programming Guide (my emphasis):
By default, Core Data dynamically creates efficient public and primitive get and set accessor methods for modeled properties (attributes and relationships) of managed object classes.
Although I've been using Core Data and mogenerator happily since I started on Objective-C, I've never had a look at what this means, until an app submission got rejected due to alleged use of private API. Long story about a generated setPrimitiveTypeValue:
method, but not what my question is about.
While reading the guide I stumbled on the idea of public and primitive accessors for entity attributes. Another quote, but further down:
For example, given an entity with an attribute
firstName
, Core Data automatically generatesfirstName
,setFirstName:
,primitiveFirstName
, andsetPrimitiveFirstName:
.
What are the primitive accessors for? Is it just so you can assign a BOOL value directly, without wrapping it in an NSNumber? If so, why would mogenerator have gone through the trouble of generating all kinds of <Attribute>Value
, set<Attribute>Value:
, primitive<Attribute>Value
, setPrimitive<Attribute>Value:
accessors?
I'm confused, who can help me out?
Related questions: