How to add an UICollectionViewLayout programmatically?
问题 I'm trying to setup a UICollectionViewLayout programmatically. I'm using a UICollectionView also without using storyboards, as well as settings its constraints. I've followed Ray Wenderlich tutorial on the subject with some changes to adapt the code to Swift 3 (as AZCoder2 did https://github.com/AZCoder2/Pinterest). Since all these examples uses storyboards, I've also introduced some changes to create the UICollectionView and its UICollectionViewLayout : collectionViewLayout = PinterestLayout