Key data: monitoring all changes in Entity of a certain type

I would like to be notified when an object of a certain type is added / modified / deleted. I know that this is possible by adding an observer to managedObjectContext , but then I have to look for three sets that return to see if they contain an object of this type. I could use filteredSetUsingPredicate , but it is inefficient to perform O (n) operation three times every time a change occurs. Is there an even more efficient way to do this?

+1
source share
1 answer

Seems ineffective? Based on what tests and observations? Do you think NSArrayController works (hint - read on Cocoa Bindings)? :-) Of course, with the SQLite storage type you get filtering in the database for retrieval, but what about changes in memory in objects?

If I were in your place, I would plug it in, and performance tested it with what I think is a reasonable worst case scenario that a real user might encounter.

If you find that the performance is really missing, it is best to post a separate question describing your data model, the reasons why you need to observe all changes to all instances of this object, and where the "Tools" say that the performance receiver is happening.

+5
source

All Articles