title: add custom header to collection view swift
body: <p>I am trying to add header to <code>collectionView</code> using custom xib file. I created the <code>xib</code> file with class implementing <code>UICollectionReusableView</code>.
  In <code>collectionViewController</code> I registered the <code>xib</code> file like this:</p>
  
  <pre><code>self.collectionView.register(UINib(nibName: HCollectionReusableView.nibName, bundle: nil), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: HCollectionReusableView.reuseIdentifier)
  </code></pre>
  
  <p>and after that in <code>viewForSupplementaryElementOfKind</code> I did</p>
  
  <pre><code>let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: HCollectionReusableView.reuseIdentifier, for: indexPath) as! HCollectionReusableView
  </code></pre>
  
  <p>and for sizing </p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -&gt; CGSize {
      return CGSize(width: 100, height: 50)
  }
  </code></pre>
  
  <p>I am getting error: Could not load NIB in bundle.
  any missing code ?   </p>
  
  <p>HCollectionReusableView class:</p>
  
  <pre><code>class HCollectionReusableView: UICollectionReusableView {
  
  static var nibName : String
      {
      get { return "headerNIB"}
  }
  
  static var reuseIdentifier: String
      {
      get { return "headerCell"}
  }
  
  
  
  override func awakeFromNib() {
      super.awakeFromNib()
      // Initialization code
  }
  </code></pre>
  
  <p>}</p>