[ad_1]
I am curious to know, can I obtain this alignment in just one NSCollectionLayoutSection
.
My code for the part is:
non-public func createHeaderTagsSection(utilizing part: Part) -> NSCollectionLayoutSection {
let itemSize = NSCollectionLayoutSize(widthDimension: .estimated(100), heightDimension: .absolute(Margins.edgeDouble))
let merchandise = NSCollectionLayoutItem(layoutSize: itemSize)
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: itemSize.heightDimension)
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])
group.interItemSpacing = .fastened(Margins.spacingHalf)
let part = NSCollectionLayoutSection(group: group)
part.contentInsets = .init(prime: 0, main: Margins.edgeDefault, backside: Margins.edgeDefault, trailing: DS.Margin.edgeDefault)
part.interGroupSpacing = 8
let sectionBackground = NSCollectionLayoutDecorationItem.background(elementKind: SectionBackgroundDecorationView.identifier)
part.decorationItems = [sectionBackground]
return part
}
[ad_2]