In my Core Data app, I have objects with a date property, and I want to 
maintain a list of all years that I have objects in. I'm having trouble 
settling on an approach.

Currently, I'm listening for 
NSManagedObjectContextObjectsDidChangeNotification. This is working fine for 
additions and deletions, but it's harder for changes, mainly because I don't 
know the old value. If I did, I could check if the old year still has any other 
objects in it. As it is I have to refresh the whole list. I also get more 
notifications than I need, since I only care about date changes on this one 
entity.

Another option is to use KVO so I can be notified only of date changes. I'm 
assuming that registering as an observer for potentially thousands of Core Data 
objects doesn't carry too much overhead. The down side is that if lots of 
objects change at once, I get lots of individual callbacks, and I worry that 
that would be a bottleneck.

Recommendations? Other options?

Thanks,

-- 
David Catmull
uncom...@uncommonplace.com
http://www.uncommonplace.com/

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to