Prerequisites:
I have 2 methods in the network API:
- return list of entities (just basic info: name, id, etc.)
- return detailed info about entity
The requirement is to save only objects created by processing the second request (save to sqlite) and leave non-full objects without saving.
Also, the ‘main’ context should contain only full objects from 1st request, and any other ‘temporary’ context should contain all the others objects.
I’ve tried to create two instances of NSPersistentStoreCoordinator and use them for different types of contexts, but it seems that for one NSManagedObjectModel can exist only one coordinator (the pointer points to the same adress).
The solution that exactly solves my problem is to create two ‘forks’ of core data stack:
NSPersistentStore (inMemory) and new NSPersistenStoreCoordinator )