Skip to content

Instantly share code, notes, and snippets.

@msimard8
Created November 6, 2018 21:59
Show Gist options
  • Save msimard8/ea1691ad53db83b124a3ed9f259643b0 to your computer and use it in GitHub Desktop.
Save msimard8/ea1691ad53db83b124a3ed9f259643b0 to your computer and use it in GitHub Desktop.
override func prepare(){
super.prepare()
guard let cv = collectionView else {return}
let padding:CGFloat = 20.0
self.sectionInset = UIEdgeInsets(top: self.minimumInteritemSpacing, left: padding, bottom: 0.0, right: padding)
self.itemSize = CGSize(width: (cv.frame.size.width - self.sectionInset.left - self.sectionInset.right - cv.contentInset.left - cv.contentInset.right) , height: 350)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment