Question

Our app consumes an API, and its data model has a set of entities which describe objects returned by that API, e.g. Categories and Locations. It also has a set of entities which describe ways the app uses those objects, e.g. Favourite Categories and Recent Locations. This second set of entities has a relationships to the first, e.g. each Favourite Category has a Category.

We're now expanding to a suite of apps, several of which will consume the same API. They'll need a data model which describes the API objects, so they want the first set of entities, but they may want to use them differently so their data model shouldn't include the second set of entities.

Is it possible to split up the model definition, so each project can use the parts they share and not the parts they don't, while maintaining the relationships?

Was it helpful?

Solution

You can not have separate models that have relationships to entities in each other. What you can do is to load one model and modify it (in code) before using it. In fact, you can create an NSManagedObjectModel entirely in code. The graphical editor in Xcode is just a lot easier to use than to create it in code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top