> On Feb 18, 2017, at 4:44 PM, Daryle Walker <[email protected]> wrote:
> 
> I’m using a NSValueTransformer object to convert my Core Data to-many ordered 
> relationship from a NSOrderedSet to a NSArray so NSArrayController can use 
> it. I just connected a NSButton to the controller’s “add:” action. I get this:
> 
>> NSManagedObjects of entity 'Message' do not support 
>> -mutableArrayValueForKey: for the property ‘header'
> 
> So it seems that the controller skips my converted value and tries to alter 
> the property directly, which it can’t. I thought that the problem was that 
> NSOrderedSet.array returns an array of funny proxies, but manually copying to 
> a NSMutableArray and returning that didn’t work either. So it seems that I 
> have to make custom actions to add objects, and hopefully the controller will 
> see the changes.
> 
> But I’m wondering if I should go nuclear and create the 
> NSOrderedSetController that Apple should have done years ago. I don’t know 
> how hard this’ll be. It would be a serving-side Binding class. It would 
> inherit from NSObjectController since NSArrayController would have those 
> extra NSArray/NSSet connection methods.
> 
> Does the Bindings section of the Interface Builder section of Xcode hard-code 
> the Bindings list, or will it create entries for custom Binding-capable 
> classes? If the answer is no customization, then I would have to connect the 
> NSManagedObject instance to the controller in code.

OTOH, it may be easier to implement a to-many accessor pattern for the 
attribute 
<https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/KeyValueCoding/DefiningCollectionMethods.html#//apple_ref/doc/uid/10000107i-CH17-SW1>.
 You may need to use a different key name to get prevent Core Data from 
interfering, say “headerAsArray” or whatever.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to