Re: TreeController and "selection" Binding
Re: TreeController and "selection" Binding
- Subject: Re: TreeController and "selection" Binding
- From: Michael de Haan <email@hidden>
- Date: Fri, 12 Feb 2016 07:04:28 -0800
> On Feb 11, 2016, at 4:11 PM, Quincey Morris <email@hidden> wrote:
>>
>> Ideally, I would like to bind from IB the selection of the TreeController to the local variable, but I cannot find a way to do this. Is this possible?
>
> It’s not clear what you’re saying.
>
> Or are you saying you’re currently observing the tree controller’s “selectionIndexPaths” *property* (not *binding*) using KVO or something else, and *that’s* what’s clunky?
>
>
Hi Quincey
I see your source of confusion… did not do a very good job explaining the model and the interface.
OK… Using Swift and StoryBoards.
The interface consists of 2 textViews and 1 outlineView. Lets call the one textView “source”, and the other “pattern”.
The model represents regex matches found in the “source” textView by a regex in the “pattern” textView.
The model is pretty straight forward, with properties, including one “range” property representing a “match”
The outline view represents the model, after it is suitably parsed and implemented as an array.
A tree controller is bound to the array, and the columns of the outline view, representing various aspects of the model, are bound through the tree controller. (There is a column for the “textual” match, a column for the position and a column for the length of the match in the source.)
Goal. Highlight the matches in the source textview as the user selects a row in the outline View.
Currently, it is implement as follows. Create an outlet for the tree controller, (in this case, in my viewController). Here the treeController’s selection.(in this case, range property) is programmatically bound to a local variable, which uses the property observers of Swift ( willSet and newValue) to call a function which highlights the selected text in the “source”
Ideally, I would like to omit the outlet/programmtically binding steps and bind the treeControllers selection in IB to my local variable. So, the “clunkiness” was a referral to the outlets and programmatic binding. However, I am unable to find a “selection” binding in IB that would make it possible.
Hope that makes sense.
_______________________________________________
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