aryaxt
aryaxt

Reputation: 77596

Are Core Data generated classes considered my "Model" classes?

In Xcode when you create a data model diagram, it will also generate the classes for each entities in the diagram which inherit from NSManagedObject.

The question is are these classes considered my "Model" classes? OR are they just a bridge between my core data and model classes?

Upvotes: 0

Views: 132

Answers (1)

aryaxt
aryaxt

Reputation: 77596

Yes these classes generated by xcode are the actual model classes. I ended up writing my own model classes and then create the data model diagram based on that. a few notes:

  • every class being used by code data must inherit from NSManagedObject
  • Relationships do not need to be in the code, you can just set them in the model diagram.
  • NSArray and NSMutableArray are not accepted, you should use NSSet instead
  • You should not use int in your model you should use NSNumber instead
  • If you want the core data models to use the classes written by you, then you must set the class names in your model diagram

Upvotes: 1

Related Questions