At the moment, I have two Core Data models, Model A and Model B.
Model A needs a value from Model B. (Model A -> Entity1 -> valueFromModelB)
At the moment, I’m executing a fetch request and filtering in Model A’s subclass of NSObject. However, this doesn’t seem very efficient because I need to update this value quite often.
What would be the best way to accomplish this? Would it be better to merge the entities from Model A and Model B and create a relationship between the two? Ideally I’d like to keep these separate, but if merging is easier and more efficient, then I may go that route.
From your question, was not sure if you have already looked at the option of prefetching to save some over-head. According to Core Data Documentation, here is a code snippet for prefetching.
The code fetches employee and department information, but what I was not sure was if Department is in a different data model, can it be put to use using something like a NSPersistentStoreCoordinator.
One other note from Apple’s Core Data preformance recommendation is
So if ideally if you can merge two different Core Data models, that is going to save memory and round-trips to fetch data.