Skip to content

Instantly share code, notes, and snippets.

@tifoaudii
Last active March 23, 2020 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tifoaudii/2f10bd38acd41b623d0c2071f37e777c to your computer and use it in GitHub Desktop.
Save tifoaudii/2f10bd38acd41b623d0c2071f37e777c to your computer and use it in GitHub Desktop.
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