title: My CollectionView with custom cells keeps crashing the program, even tho it initially compiles/runs
body: <p>I'm trying to create a UICollectionView in which cells have textLabels in them, and the program compiles, runs, but crashes when I try to segue to the screen with this table. </p>
  
  <p>It has a custom cell class, called GridViewCell with one field, and the custom class inherits from UICollectionViewCell. The code for the ViewController is:</p>
  
  <pre><code>import Foundation
  import UIKit
  
  class GridViewController : UICollectionViewController{
  
      @IBOutlet var gridView: UICollectionView! //this is the ViewController
  
      var someArray1 : [String] = []
      var someArray2 : [String] = []
      var totalSize: Int {
      return entireArray.count
      }
      var entireArray: [[String]] {
          return combine(someArray1, someArray2) //combine takes the arrays and makes a 2D array with both of them in it
      }
      let subArraySize = 4
  
  
      override func viewDidLoad(){
          super.viewDidLoad()
          self.collectionView!.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "gridCell")
      }
  
      override func numberOfSections(in collectionView: UICollectionView) -&gt; Int {
      return 1
  }
  
      override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
          return  totalSize * subArraySize
      }
  
      override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; GridViewCell {
          if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath as IndexPath) as? GridViewCell{
              cell.textLabel.text = "ddd" //sample text just to test it
              cell.backgroundColor = UIColor.gray
              return cell
          }
          else {
              DLog("error")
              return GridViewCell()
          }
      }
  }
  </code></pre>
  
  <p>The error message I get in the debugger is:</p>
  
  <p>"Terminating app due to uncaught exception    'NSInternalInconsistencyException', reason: 'the cell returned from -collectionView:cellForItemAtIndexPath: does not have a reuseIdentifier - cells must be retrieved by calling - dequeueReusableCellWithReuseIdentifier:forIndexPath:'"</p>
  
  <p>In my interface builder, I HAVE specified the reuse identifier to be "gridCell" and its class is GridViewCell.</p>
  
  <p>how can I rectify this?</p>