ios - How do I make the model classes in my library reusable for Core Data? -
if create reusable ios library how create model objects useable core data i.e. model objects inherit nsobject or nsmanagedobject?
at least know won't able override isequal: , hash since nsmanagedobject uses them.
the preferred way let core data management features in xcode create model classes you, add methods generated classes necessary. example, if had model class 'thing', might:
- create core data model thing entity , appropriate attributes
- select thing entity , choose editor > create nsmanagedobject subclass
- save file; you'll new thing.h , thing.m in project
- edit classes normal, being careful not override of these methods
Comments
Post a Comment