Re: Core Data - use of simple accessors vs. KVC
Re: Core Data - use of simple accessors vs. KVC
- Subject: Re: Core Data - use of simple accessors vs. KVC
- From: Negm-Awad Amin <email@hidden>
- Date: Wed, 27 Aug 2008 19:36:50 +0200
Am Mi,27.08.2008 um 19:19 schrieb mmalc crawford:
On Aug 27, 2008, at 9:48 AM, Negm-Awad Amin wrote:
Am Mi,27.08.2008 um 18:22 schrieb Oleg Krupnov:
Suppose I have a Core Data model object MyObject with property
myProp
defined in the model editor's schema.
Can I use the simple accessors like this:
[myObj myProp]
[myObj setMyProp]
or am I forced to use the rather clunky valueForKey/setVakyeForKey
messages?
<http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html
>
Managed objects automatically fake accessors for entities.
No, they don't fake accessors for entities, they dynamically
generates accessor methods for managed object classes.
I call this fake.
Anyway the TS understood this.
You can subclass NSManagedObject and add properties using @property
and @dynamic, which means, that the accessors will be generated
dynamically at run-time. (Without @dynamic you will get a compiler
warning: incomplete implementation blablabla)
There is no need to create a subclass,
"You *can* subclass NSManagedObject …"
you can use a category instead.
There is no need to create a category. You can use a subclass instead.
There is documentation about @property and Core-Data esp. in
relation to retain/copy/assign. (The quintessence: Use retain!)
You may also consider 'copy' if appropriate
"There is documentation about @property and Core-Data esp. in relation
to retain/copy/assign. (The quintessence: Use retain!)"
This is all trivially found in <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdAccessorMethods.html
>
mmalc
_______________________________________________
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
Amin Negm-Awad
email@hidden
_______________________________________________
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