I have this basic compositional layout for a view of tags. The cells contain just a label with auto layout constraints. The goal is to auto size the cells both vertically and horizontally to fit the label. With compositional layout I can only get an estimated width or height when I set NSCollectionLayoutGroup to vertical or horizontal respectively. I can't get it to work for both axis. Anything I'm missing? This is what it should look like:
let layout = UICollectionViewCompositionalLayout { (section: Int, environment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection? in
let layoutSize = NSCollectionLayoutSize(widthDimension: .estimated(100), heightDimension: .estimated(40))
let item = NSCollectionLayoutItem(layoutSize: layoutSize)
let group = NSCollectionLayoutGroup.vertical(layoutSize: layoutSize, subitem: item, count: 1)
let section = NSCollectionLayoutSection(group: group)
section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 20, bottom: 0, trailing: 20)
section.interGroupSpacing = 10
section.orthogonalScrollingBehavior = .groupPaging
return section
}