title: Custom Footer view for UICollectionview in swift
body: <p>I am re-writting an objective-C app of min in swift and decided that a collection view works better then a tableview in my case. So i have the collectionview all set up exactly how i want it and now i need to add a footer to my collection view.</p>
  <p>In objective-C it was very easy for me, all i did was create a UIView, add objects to it, and add it to my tableview like this.</p>
  <pre><code>self.videoTable.tableFooterView = footerView;
  </code></pre>
  <p>Now i've been trying in my collection view to get a similar solution, however i've had no luck so far.</p>
  <p>Is there a simple <code>.collectionviewFooterView</code> or something that i can add my UIView to?</p>
  <p><strong>EDIT</strong>
  i found similar ideas <a href="https://stackoverflow.com/questions/14852004/how-to-expand-uicollectionview-contentsize-when-paging-enable">HERE</a> if that helps create an answer</p>
  <p><em><strong>EDIT</strong></em></p>
  <p>I've been thinking on ways to achieve this so right now my idea is to add the footer view to the end of the collection view using the following code:</p>
  <pre><code>var collectionHeight = self.collectionView.collectionViewLayout.collectionViewContentSize().height
  
  footerView.frame = CGRectMake(0, collectionHeight, screenSize.width, 76)
  </code></pre>
  <p>The only issue i'm having with this workaround is i need to add more space to the contentView of the colletionView and i am having no luck with that</p>
  <p><em><strong>My Solution</strong></em></p>
  <p>I solved it using a work-around (not the prettiest but it works), i add the UIView to the uicollectionview using a simple</p>
  <pre><code>footerView.frame = CGRectMake(0, collectionHeight - 50, screenSize.width, 50)
  self.collectionView.addSubview(footerView)
  </code></pre>
  <p>and set the layout insets using this:</p>
  <pre><code>alLayout.contentInsets = UIEdgeInsetsMake(2, 2, 52, 2)
  </code></pre>