title: NSToolbar in Xcode 7 using Storyboards (NSWindowController -> NSSplitViewController)
body: <p>Hi I've seen this question asked a few times already but with no definite answer yet so I created it for xcode 7 and swift2 (which may have changed things a bit anyway).</p>
  
  <p>I created a project using Xcode 7 and Cocoa OSX Story boards + swift2, so my project started with a <strong>NSWindowController</strong> that Connects to a NSViewController (as expected!). I added a <strong>NSToolbar</strong> to my window controller and added a <strong>NSButton</strong> to the toolbar. I changed my NSViewController to be one of the new <strong>NSSplitViewController</strong> that links to three <strong>NSViewController</strong>s and displays their views horizontally - with vertical dividers - (similar to the layout you see in the photo app or pages in Yosemite +). My final goal will be that the button in My toolbar shows and hides the first split.</p>
  
  <p>It is my understanding is, and I would expect that to achieve this I should create an action in the NSSplitViewController that changes the auto layout constrains more or less in the way they are working it out here: <a href="https://stackoverflow.com/questions/27352431/how-to-do-collapse-and-expand-view-in-mac-application">How to do collapse and expand view in mac application?</a>.</p>
  
  <p>And then somehow link this action to the NSButton that is in the Toolbar... which happens to be in the NSWindowController (far up and isolated in the hierarchy)... </p>
  
  <p>I have already gone through other questions about NSToolbar and storyboards and failed to accomplish my goal:</p>
  
  <ul>
  <li>The YouTube video: <a href="https://www.youtube.com/watch?v=i021PhLS54E" rel="noreferrer">Cocoa Programming L17 - NSToolbar</a> which is the closest I found to solve the problem, but his method does not work for storyboards, only creating your own xib file.</li>
  <li>In this question: <a href="https://stackoverflow.com/questions/24219441/how-to-use-nstoolbar-in-xcode-6-and-storyboard">How to use NSToolBar in Xcode 6 and Storyboard?</a> One person proposes to make the link using the first reponder and expecting everything to hook up at run-time (which looks a bit dodgy and not the way apple would implement it I think...). A second person suggested to create a view controller variable in the NSWindowController and manipulate its properties from there... but again, a bit dodgy too. </li>
  </ul>
  
  <hr>
  
  <ul>
  <li>One latest comment I saw in that question which <strong>seems the best way to tackle the problem</strong> (but still not as good as I guess it could be) is to add a NSObjectController to the dock of each scene and when the scene loads, set the values of the objects to the other secene's controller. Is this really the best way to go ahead? If so, how could I achieve this one?</li>
  </ul>
  
  <hr>
  
  <p>Apple did mention (again) in WWDC15 that they created storyboards for osx and the split-view controller that owns view-controllers so that you can move your logic and work to the specific view-controller, so I would be expecting to do everything from inside my split-view controller as this is the target that needs to change.</p>
  
  <p>Does anyone know how to achieve this from the view controller itself? I really haven't been able to find a way to connect my ToolBarItem to it.</p>