At 13m45s near the end you removed the minimum spacing using size inspector for the UICollectionView. I also like to set properties for UI elements in code, so looked it up in the UICollectionViewFlowLayout doc. Just need to add the following to the end of MasterViewController viewDidLoad:
layout.minimumInteritemSpacing = 0
Thanks for making the video, I can see this is going to be of much use for me.
It’s true that we set the minimum spacing between the cells themselves to be 0. That means that we really are butting them together with no space between them.
If you go back to around 6:30 in the video, you might recall that we centered a green UIView in the prototype cell. We also sized the UIView with AutoLayout constraints of 2 points (with Constrain to Margins unchecked.)
That makes the UIView smaller than the CollectionView cell by 4 points. So we end up with 2 points of white space around the views. That creates the white space that you see.
That looks good. You can sometimes gang the conditions together, on one line in the guard. That way you can create the deatilViewController only if the both of the conditions are met.
Try this:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "MasterToDetail" { guard let indexPath = collectionView?.indexPathsForSelectedItems()?.first, paper = papersDataSource.paperForItemAtIndexPath(indexPath) else { return nil } let detailViewController = segue.destinationViewController as! DetailViewController detailViewController.paper = paper } }