Core Data notifications
Core Data notifications
- Subject: Core Data notifications
- From: Bob Peterson <email@hidden>
- Date: Sat, 8 Oct 2005 10:21:14 -0400
I'm making a program that organizes like iTunes: a list of groups
such as iTunes' Library of songs, playlists of songs, servers of
songs, and so on. My program likewise has a class (call it Master)
that has an array property of base class objects (Source protocol).
One class implementing Source is Program. (Funny, the application
domain has nothing to do with computers, though.)
I've designed key Master.sources as a read-only array with just two
methods: countOfSources and objectInSourcesAtIndex. Program is a
class that is stored using a Core Data entity, but the other kinds of
Sources might not be in Core Data (being computed or coming from
somewhere else). When a new Program is created it needs to show up
in Master.sources. Master observes
NSManagedObjectContextObjectsDidChangeNotification and paws through
the collections of added and deleted objects to see if any are
Programs. If so, then it does
[self willChangeValueForKey:@"countOfSources"];
[self didChangeValueForKey:@"countOfSources"];
This (A) bugs me since I can't send willChangeValueForKey -before-
the managed object context is changed, and (B) my ArrayController
doesn't update the display of sources.
How am I going about this wrong?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden