开发者

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 i开发者_如何学JAVAn 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?


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜