On Feb 12, 2016, at 14:00 , Michael de Haan <m...@comcast.net> wrote:
> 
> I could not get from that binding to the actual instance of my model. There 
> does not seem to be an “Array.ObjectAtThisIndexPath" which I think you are 
> alluding to? Ie bind this to a local variable (indexPaths) and derive the 
> instance of the model from this?

I still don’t understand what you’re saying. A binding binds to a *property* of 
an object — limited by IB to the objects that are available in the context. In 
a storyboard scene with a view controller at the top level, this property must 
be a property of the view controller. However, if the view controller has 
properties that lead elsewhere, you can use a key path to extend your reach.

For example, if the view controller itself has a “selectedIndexPaths” property, 
you can bind to that. If this property is in a data model instead, you’ll need 
to give the view controller a “model” property, and bind to 
“model.selectedIndexPaths”. And so on. It’s a bit harder in a storyboard than a 
XIB, because you can’t bind directly to the world outside the view controller 
(e.g. the window controller) without going through the view controller.

There is no “local” (i.e. stack) variable involved. Do you perhaps mean a 
private instance variable? In Swift, that’s actually a property.

Note that in Swift, any property that you bind to or through should be marked 
‘dynamic’, and in either language, all such properties must be updated 
KVO-compliantly when they change.

_______________________________________________

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

This email sent to arch...@mail-archive.com

Reply via email to