title: Terminating app: could not dequeue a view of kind: UICollectionElementKindCell with identifier
body: <p>I'm implementing a custom .xib for a UICollectionViewCell and the app is crashing with:</p>
  
  <blockquote>
    <p>Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier DaySelectorCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'</p>
  </blockquote>
  
  <p>There are several answers around that suggest that the identifier has a space in it or is missing. I've triple-checked everything though, and it's still throwing.</p>
  
  <p>Here's my Storyboard config for the xib:</p>
  
  <p><img src="https://i.stack.imgur.com/ncYfA.png" width="140"></p>
  
  <p><img src="https://i.stack.imgur.com/sFrWL.png" width="260"></p>
  
  <p><img src="https://i.stack.imgur.com/zZh0V.png" width="260"></p>
  
  <p>Here's my DaySelectorCell.swift class:</p>
  
  <pre><code>import Foundation
  import UIKit
  
  class DaySelectorCell: UICollectionViewCell {
      @IBOutlet weak var dayOfWeekButton: UIButton!
      var dayNumber: Int = -1
  }
  </code></pre>
  
  <p>And my collectionView delegate implementation:</p>
  
  <pre><code>extension CustomViewController: UICollectionViewDelegate, UICollectionViewDataSource {
  
      let days = ["M", "T", "W", "T", "F", "S", "S"]
  
      func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
          let id = "DaySelectorCell"
          var cell: DaySelectorCell! = self.daySelector.dequeueReusableCellWithReuseIdentifier(id, forIndexPath: indexPath) as? DaySelectorCell
          if cell == nil {
              collectionView.registerNib(UINib(nibName: id, bundle: nil), forCellWithReuseIdentifier: id)
              cell = collectionView.dequeueReusableCellWithReuseIdentifier(id, forIndexPath: indexPath) as? DaySelectorCell
          }
  
          cell.dayOfWeekButton.setTitle(days[indexPath.row], forState: .Normal)
          cell.dayNumber = indexPath.row
  
          return cell
      }
  
      func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
          return 7
      }
  }
  </code></pre>