I narrowed down the root cause and its happening when you pin the NSCollectionLayoutBoundarySupplementaryItem that are applied to the layout through UICollectionViewCompositionalLayoutConfiguration ..
Here's the narrowed down code that's causing this crash..
func layout() -> UICollectionViewLayout {
UICollectionViewCompositionalLayout(sectionProvider: { [self] section, _ in
// Building section here
}, configuration: configuration)
}
var configuration: UICollectionViewCompositionalLayoutConfiguration {
let configuration = UICollectionViewCompositionalLayoutConfiguration()
var boundaryItems: [NSCollectionLayoutBoundarySupplementaryItem] = []
var offset = 0
for column in 0..<datasource.numberOfColumns {
let columnHeaderSize = NSCollectionLayoutSize(widthDimension: .absolute(100), heightDimension: .absolute(44))
let headerView = NSCollectionLayoutBoundarySupplementaryItem(
layoutSize: columnHeaderSize,
elementKind: "columnHeader",
alignment: .topLeading,
absoluteOffset: CGPoint(x: offset, y: 0)
)
headerView.pinToVisibleBounds = true
headerView.zIndex = 2
offset += 100.0
boundaryItems.append(headerView)
}
configuration.boundarySupplementaryItems = boundaryItems
return configuration
}
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: