title: 10.11 NSCollectionView: "could not load the nibName: NSCollectionViewItem in bundle NSBundle"
body: <p>I want to use a NSCollectionView with the new API model from Swift according to <a href="https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKit/#10_11CollectionView" rel="noreferrer">https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKit/#10_11CollectionView</a>. Since I prefer doing as much as possible in IB, I want to use the Content binding and follow the section <em>Binding Content to an NSCollectionView (New since WWDC Seed)</em> on the linked page.</p>
  
  <p>I've pulled an NSCollectionView from the object library into my storyboard, then deleted the additionally generated <em>prototype</em> segue via the connections inspector, and also removed the generated NSCollectionViewItem. Then, I've set the Collection View's layout to <em>Flow</em>, and connected the collection view to an outlet of my view controller.</p>
  
  <p>Next, I've created a separate .xib file with Xcode's view template, and put in the necessary views. I've also pulled in a "Collection View Item" object.</p>
  
  <p>Then, I've adjusted the view controller's viewDidLoad method to register the nib with the collection view.</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      let nib = NSNib(nibNamed: "Item", bundle: nil)!
      collectionView.registerNib(nib, forItemWithIdentifier: "")
  }
  </code></pre>
  
  <p>Finally, I've connected my array controller to the Content binding of the NSCollectionView.</p>
  
  <p>However, when I try to launch the app, an exception is thrown:</p>
  
  <blockquote>
    <p>[NSNib _initWithNibNamed:bundle:options:] could not load the nibName: NSCollectionViewItem in bundle NSBundle</p>
  </blockquote>
  
  <p>The exception occurs only if my array has actual contents, so only when CollectionViewItems need to be instantiated.</p>
  
  <p>What am I doing wrong here?</p>
  
  <p><strong>Sample project here: <a href="https://scriptreactor.com/collectionviewtest.zip" rel="noreferrer">https://scriptreactor.com/collectionviewtest.zip</a></strong></p>