views:

26

answers:

1

The documentation on Core Data entities says:

You might implement a custom class, for example, to provide custom accessor or validation methods, to use non-standard attributes, to specify dependent keys, to calculate derived values, or to implement any other custom logic.

I stumbled over the non-standard attributes claim. It's just a guess: If my attribute is anything other than NSString, NSNumber or NSDate I will want to have a non-standard Attribute with special setter and getter methods? So, for example, if I wanted to store an image, this would be a non-standard Attribute with type NSData and a special method, say -(void)setImageWithFileURL:(NSURL*)url which then pulls the image data from the file, puts in in an NSData and assigns it to core data?

Or did I get that wrong?

+1  A: 

A non-standard attribute can be anything. Some common examples are:

  • an image
  • a binary key
  • encrypted data
  • audio

Just about anything that cannot be represented as a number or string falls into this category.

update

Transformable is not a data type of it's own. It is a way to say that a non-standard value is going to be stored here. Under the covers it is binary. The Transformable tag is a hint to Core Data to go look at the subclass's property setting.

Marcus S. Zarra
Transformables are considered non-standard, too?
dontWatchMyProfile