Last active
March 23, 2020 03:13
-
-
Save tifoaudii/2f10bd38acd41b623d0c2071f37e777c 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
fileprivate func createOnGoingMovieSection() -> NSCollectionLayoutSection { | |
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalWidth(2/3)) | |
let item = NSCollectionLayoutItem(layoutSize: itemSize) | |
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalWidth(1.0)) | |
let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitem: item, count: 3) | |
group.contentInsets = .init(top: 5, leading: 0, bottom: 5, trailing: 20) | |
let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), | |
heightDimension: .estimated(44)) | |
let sectionHeader = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, elementKind: MovieViewController.sectionHeaderElementKind, alignment: .top) | |
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