title: How to access splitViewItems by item name in Swift + Storyboards
body: <p>I'm currently using a NSSplitViewController that has a two child split view items (one is a View Controller and one is another Split View Controller as shown:</p>
  
  <p><img src="https://i.stack.imgur.com/s7ZkR.png" alt="enter image description here"></p>
  
  <p>I would like to access the split view items programatically to change the collapse status (and later some other properties) from the Window Controller.</p>
  
  <p>I can easily access the split view items by position using this:</p>
  
  <pre><code>    let myMainSplitViewController = self.contentViewController as! NSSplitViewController
      let mySplitViewController2 = myMainSplitViewController.splitViewItems[1]
      mySplitViewController2.collapsed = !mySplitViewController2.collapsed
  </code></pre>
  
  <p>I'm thinking that in the long term using the position (1 in the example) will not be a good idea (for example if I rearrange the split items in the future). Is there a way to access the split view items with a more permanent link thank just the index number?</p>
  
  <p>I'm thinking I could try to assign Storyboard ID to the controllers of the split view items and search for the exact one by name using the array filter method, but this may be a bit cumbersome... is there something easier like this?:</p>
  
  <pre><code>myMainSplitViewController.splitViewItems["My Split View Controller 2"] 
  </code></pre>