Re: Use of KVC Array operators
Re: Use of KVC Array operators
- Subject: Re: Use of KVC Array operators
- From: Aaron Burghardt <email@hidden>
- Date: Tue, 16 Mar 2010 10:41:56 -0400
On Mar 12, 2010, at 6:13 PM, Eli Bach wrote:
> It's not a problem. In retrospect, doing this would mean that KVO would need to automagically observe two 'levels' for changes, which seems to me to be unlikely for KVO to do.
>
> I've decided to short-circuit the problem by adding a direct relation from instanceA to relationC.
>
You gave up too soon :-)
I recently set up a similar arrangement with bindings. I created 3 controllers in the NIB:
classAObjectController
bind Content Object to "file's owner.instanceOfA"
classBArrayController
bind Content Set to classAObjectController.selection.relationToB
classCArrayController
bind Content Array to email@hiddenionToC
I think there are a number of valid ways to do this, such as leaving out the classAObjectController. The middle controller was necessary to avoid binding errors, but it is working very well now.
HTH,
Aaron
On Mar 11, 2010, at 10:34 PM, Eli Bach wrote:
> The operators mentioned on this page, particularly "@unionOfSets".
>
> <http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html>
>
> I have the following Core Data object's setup
>
> ClassA ClassB ClassC
> relationA --> relationB --> relation C
>
> where each of the relations is a many to one [one class A, many class B, and one class B, many class C].
> Not all ClassB's will have ClassC objects attached to them
>
> I have an instance of classA, and I want an NSArrayController with all the ClassC objects for all the ClassB objects that are related to that specific instance of ClassA, preferably in a way that uses KVO instead of programmatically updating with fetches/predicates/etc.
>
> What would be the right way to bind the NSArrayController, assuming the nib owner has an instance of classA:
>
> ie:
>
> bind content set to
>
> File Owner.instanceOfA.?
>
> Thanks,
>
> Eli
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden