Re: Binding NSTextField to an array
Re: Binding NSTextField to an array
- Subject: Re: Binding NSTextField to an array
- From: Jeremy Hughes <email@hidden>
- Date: Mon, 06 Mar 2017 13:32:06 +0000
> From what I understand of your example, you’re not “binding” anything in a Cocoa sense.
In the case of the single value, the text field is set up via the Bindings pane of Interface Builder so that “Value" says “Bind to File’s Owner” with a model key path of self.value. (And “value" is declared as dynamic so that Swift will take care of KVO.) This works fine. Is this not a Cocoa binding?
What I don’t understand is why this works for a single value but doesn’t work for an array of values, where I change the model key path to self.values.
> What you is an NSArrayController. Bind your text field to the array controller. Supply the array controller with content, and have it derive the selected value, be it single or multiple.
OK. I now have an array controller that is bound to File’s Owner with a model key path of self.values, and I then bind the text field to the array controller with a Controller Key value of “selection” (although I’m not sure that’s right, because the array is not actually displayed anywhere for users to select items).
Now I get the following error:
Cannot create number from object <_NSControllerObjectProxy: 0x6000000070b0> of class _NSControllerObjectProxy
Jeremy
_______________________________________________
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