title: UICollectionViewCell awakeFromNib never called even though registerNib is called
body: <p>The code below attempts to create a <code>UICollectionView</code> within a custom view. Since the <code>UICollectionView</code> is not created in Storyboard, it means creating the custom <code>UICollectionViewCells</code> in a XIB.</p>
  
  <p>However, the <code>awakeFromNib</code> function is never called for the custom <code>UICollectionViewCell</code>, which causes issues in rendering the <code>UICollectionView</code>.</p>
  
  <p>How to fix this?</p>
  
  <p>CustomView.swift:</p>
  
  <pre><code>class CustomView : UIView, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
  
      @IBOutlet weak var collectionView: UICollectionView!
  
      private func doInit() {
          if let nibsView = NSBundle.mainBundle().loadNibNamed("CustomCellView", owner: self, options: nil) as? [UIView] {
              let nibRoot = nibsView[0]
              self.addSubview(nibRoot)
              nibRoot.frame = self.bounds
  
              // Register UICollectionViewCell NIB
              collectionView.registerNib(UINib(nibName: CustomCellNib, bundle: nil), forCellWithReuseIdentifier: CustomCellID)
          }
      }
  }
  </code></pre>
  
  <p>CustomCell.swift:</p>
  
  <pre><code>class CustomCell: UICollectionViewCell {
  
      override func awakeFromNib() {
          super.awakeFromNib()
          doInit(frame)
      }
  
  }
  </code></pre>