Created
April 5, 2020 13:14
-
-
Save tifoaudii/d7025a9c30ca2ab1432822bd30c6e619 to your computer and use it in GitHub Desktop.
This file contains 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
//1 | |
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalWidth(1.0)) | |
let item = NSCollectionLayoutItem(layoutSize: itemSize) | |
//2 | |
let groupSize = NSCollectionLayoutSize(widthDimension: .absolute(140), heightDimension: .absolute(220)) | |
let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitem: item, count: 1) | |
group.contentInsets = .init(top: 5, leading: 5, bottom: 5, trailing: 5) | |
//3 | |
let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .estimated(44)) | |
let sectionHeader = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, elementKind: MovieViewController.sectionHeaderElementKind, alignment: .top) | |
//4 | |
let section = NSCollectionLayoutSection(group: group) | |
section.orthogonalScrollingBehavior = .groupPaging | |
section.boundarySupplementaryItems = [sectionHeader] | |
return section |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment