Skip to content

Instantly share code, notes, and snippets.

@TungVuDuc2805
Created August 15, 2020 17:38
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 TungVuDuc2805/66c60726d359fb3329672649280dc23f to your computer and use it in GitHub Desktop.
Save TungVuDuc2805/66c60726d359fb3329672649280dc23f to your computer and use it in GitHub Desktop.
init(){
let layout = UICollectionViewCompositionalLayout { (section, env) -> NSCollectionLayoutSection? in
// 1
let item = NSCollectionLayoutItem(layoutSize: .init(widthDimension: .fractionalWidth(1.0), heightDimension: .absolute(200)))
// 2
let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .absolute(200)), subitems: [item])
// 3
let section = NSCollectionLayoutSection(group: group)
return section
}
super.init(collectionViewLayout: layout)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment