Skip to content

Instantly share code, notes, and snippets.

@iosdevie
Created May 29, 2021 19:34
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 iosdevie/5381b08eb4f2420c71dc789182171d61 to your computer and use it in GitHub Desktop.
Save iosdevie/5381b08eb4f2420c71dc789182171d61 to your computer and use it in GitHub Desktop.
private func createLayout() -> UICollectionViewLayout {
//1
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),heightDimension: .fractionalHeight(1.0))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
//2
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),heightDimension: .absolute(44))
//3
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize,subitems: [item])
let section = NSCollectionLayoutSection(group: group)
let layout = UICollectionViewCompositionalLayout(section: section)
return layout
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment