On Feb 12, 2016, at 9:04 AM, Michael de Haan <m...@comcast.net> wrote: > > 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.
Have you considered just implementing the outline view delegate method outlineViewSelectionDidChange() and, in there, using treeController.selectedObjects[i].range to highlight the matches in the source text view? Bindings are great if they happen to make things easier/simpler, but sometimes it's easier/simpler to go another route. Regards, Ken _______________________________________________ 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