title: UICollectionView cell spacing not working anymore
body: <p>I have been working on this app for a few days, I am working on laying out a UICollectionView to appear like a grid with no spacing in between the cells. It was working fantastically after I found <a href="https://stackoverflow.com/a/28327193/4427300">this answer</a> and implemented it into my own program. I worked on some other files and updated my computer, then I came back and tested this app just to see where I was and for some reason there is horizontal spacing in between cells. I have looked at a few other questions similar to this one, but I'm just wondering how to fix this and why this happened when I didn't change anything related to the layout. </p>
  
  <p><strong>Here's is what it looks like now:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/H4tCC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H4tCC.png" alt="Here&#39;s what it looks like now"></a></p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {
  
  @IBOutlet weak var collectionView: UICollectionView!
  
  var model = BoardModel()
  var board = Board()
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
  
      collectionView.delegate = self
      collectionView.dataSource = self
  
      board = model.newGame(4, 4)
  
      // Remove the spacing between the cells in collectionView
      // Also make the cells the correct size to form a square/rectangle
      let screenSize: CGRect! = collectionView.bounds
      let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
      layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
      layout.itemSize = CGSize(width: screenSize.width/CGFloat(board.columns), height: screenSize.width/CGFloat(board.columns))
      layout.minimumInteritemSpacing = 0
      layout.minimumLineSpacing = 0
      collectionView!.collectionViewLayout = layout
  
      // Center the collectionView
      collectionView.contentInset.top = max((collectionView.frame.height - collectionView.contentSize.height) / 5, 0)
  
  }
  </code></pre>
  
  <p>The reason I'm using the collectionView bounds instead of the UIScreen.mainScreen().bounds is because my collectionView has 20 spacing around all the edges. </p>