Jonathan Sterling
Jonathan Sterling

Reputation: 18375

Instance variables of custom classes in NSManagedObject subclass

I have written a class Foo, and would like to include a Foo object as a property for an NSManagedObject subclass. Is this possible? Can Core Data store information other than strings, booleans, integers, etc.?

Upvotes: 0

Views: 640

Answers (1)

Rüdiger Hanke
Rüdiger Hanke

Reputation: 6255

One way is to write an NSValueTransformer that transforms your Foo object to NSData. Make the attribute "Transformable" and give the name of the transformer in the attribute settings.

For more details or information or other options, see the Core Data Programming Guide, in particular the section "Non-Standard Persistent Attributes".

Upvotes: 2

Related Questions