• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: TreeController and "selection" Binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TreeController and "selection" Binding


  • Subject: Re: TreeController and "selection" Binding
  • From: Quincey Morris <email@hidden>
  • Date: Fri, 12 Feb 2016 14:16:13 -0800
  • Feedback-id: 167118m:167118agrif8a:167118sgSLTrlmpH:SMTPCORP

On Feb 12, 2016, at 14:00 , Michael de Haan <email@hidden> 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 (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


  • Follow-Ups:
    • Re: TreeController and "selection" Binding
      • From: Michael de Haan <email@hidden>
References: 
 >TreeController and "selection" Binding (From: Michael de Haan <email@hidden>)
 >Re: TreeController and "selection" Binding (From: Quincey Morris <email@hidden>)
 >Re: TreeController and "selection" Binding (From: Michael de Haan <email@hidden>)
 >Re: TreeController and "selection" Binding (From: Quincey Morris <email@hidden>)
 >Re: TreeController and "selection" Binding (From: Michael de Haan <email@hidden>)

  • Prev by Date: Re: TreeController and "selection" Binding
  • Next by Date: Re: TreeController and "selection" Binding
  • Previous by thread: Re: TreeController and "selection" Binding
  • Next by thread: Re: TreeController and "selection" Binding
  • Index(es):
    • Date
    • Thread