Untitled

 avatar
unknown
plain_text
4 years ago
807 B
5
Indexable
let width = env.availableWidth - 2 * 16 - 3 * 16
            let itemSize = NSCollectionLayoutSize(
                widthDimension: .absolute(width),
                heightDimension: .absolute(width)
            )
            let item = NSCollectionLayoutItem(layoutSize: itemSize)

            let rowSize = NSCollectionLayoutSize(
                widthDimension: .fractionalWidth(1),
                heightDimension: .absolute(width)
            )
            let row = NSCollectionLayoutGroup.horizontal(
                layoutSize: rowSize, subitem: item, count: 3
            )
            row.interItemSpacing = 16

            let section = NSCollectionLayoutSection(group: row)
            section.contentInsets.leading = 16
            section.contentInsets.trailing = 16
            return section
Editor is loading...