Created
June 18, 2021 16:46
-
-
Save froggomad/03b7e80ce7f737545fe98fe9113e0712 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension TitledCollectionView { | |
class Layout: UICollectionViewFlowLayout { | |
static let heightConstant: CGFloat = 150 | |
override func prepare() { | |
super.prepare() | |
guard let collectionView = collectionView else { return } | |
// TODO: why -13 to make the size even? section insets? | |
itemSize = CGSize(width: collectionView.frame.width / 3 - 13, height: Self.heightConstant - 40) | |
scrollDirection = .horizontal | |
sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment