Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hlung/2bb32330b7dac36d756b9d3b95bc7180 to your computer and use it in GitHub Desktop.
Save hlung/2bb32330b7dac36d756b9d3b95bc7180 to your computer and use it in GitHub Desktop.
let layout = UICollectionViewCompositionalLayout(sectionProvider: {
(sectionIndex: Int, layoutEnvironment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection? in
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
heightDimension: .estimated(30))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
heightDimension: .estimated(30))
let group = NSCollectionLayoutGroup.horizontal(
layoutSize: groupSize,
subitem: item,
count: 1
)
let section = NSCollectionLayoutSection(group: group)
section.interGroupSpacing = 16
return section
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment