title: How to make both header and footer in collection view with swift
body: <p>How to make both header and footer in collection view in swift ?</p>
  
  <p>I'm trying to combine a header and a footer together but it keep crashing, I couldn't find swift tutorial to understand it.</p>
  
  <p>I don't how to return supplementary view for both rather just one .</p>
  
  <p>I set them both on the storyboard (class + identifier )   </p>
  
  <pre><code> override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -&gt; Int {
      //#warning Incomplete method implementation -- Return the number of sections
      return 2
  }
  
  
  override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
      //#warning Incomplete method implementation -- Return the number of items in the section
      return 10
  }
  
  
  
  
  override func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -&gt; UICollectionReusableView {
      var header: headerCell!
      var footer: footerCell!
  
  
  
      if kind == UICollectionElementKindSectionHeader {
          header =
              collectionView.dequeueReusableSupplementaryViewOfKind(kind,
                  withReuseIdentifier: "header", forIndexPath: indexPath)
              as? headerCell
  
  }
      return header
  
  }
  </code></pre>
  
  <blockquote>
    <p><strong>Error:</strong> 
    UICollectionElementKindCell with identifier one - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'</p>
  </blockquote>
  
  <pre><code>override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; profileCC {
      let cell = collectionView.dequeueReusableCellWithReuseIdentifier("one", forIndexPath: indexPath) as! profileCC
  
      // Configure the cell
  
      return cell
  }
  
  
  
  override func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -&gt; UICollectionReusableView {
  
      switch kind {
  
      case UICollectionElementKindSectionHeader:
  
          let headerView = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "header", forIndexPath: indexPath) as! headerCell
  
          headerView.backgroundColor = UIColor.blueColor();
          return headerView
  
      case UICollectionElementKindSectionFooter:
          let footerView = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "footer", forIndexPath: indexPath) as! footerCell
  
          footerView.backgroundColor = UIColor.greenColor();
          return footerView
  
      default:
  
          assert(false, "Unexpected element kind")
      }
  }
  </code></pre>
  
  <p>I hope someone will help.</p>