You are right, but what KVC messages I should send to the model in case of unordered sets, e.g. if I use Core Data?
According to the Core Data docs (http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdAccessorMethods.html#//apple_ref/doc/uid/TP40002154-SW9), I should call these dynamic accessors - (void)addDirectReportsObject:(Employee *)value; - (void)removeDirectReportsObject:(Employee *)value; Is this contradicting with the KVC rules? I am confused... On Fri, Sep 5, 2008 at 4:53 AM, Rob Keniger <[EMAIL PROTECTED]> wrote: > > On 04/09/2008, at 9:52 PM, Oleg Krupnov wrote: > >> The question is: am I allowed to alter the model directly, or should I >> always use the controller? > > > You can change the model directly, but you must use KVC-compliant methods to > do so, unless you fire -willChangeValueForKey and -didChangeValueForKey in > your custom method. > > Normally you would use indexed accessor methods for collection types, e.g.: > > - (unsigned int)countOfFoo; > - (id)objectInFooAtIndex:(unsigned int)index; > - (void)insertObject:(id)anObject inFooAtIndex:(unsigned int)index; > - (void)removeObjectFromFooAtIndex:(unsigned int)index; > - (void)replaceObjectInFooAtIndex:(unsigned int)index > withObject:(id)anObject; > > Have a look here: > > http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#//apple_ref/doc/uid/20002174 > > -- > Rob Keniger > > > > _______________________________________________ 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 [EMAIL PROTECTED]