kishikawakatsumi / IBPCollectionViewCompositionalLayout

Backport of UICollectionViewCompositionalLayout to earlier iOS 12
MIT License
1.55k stars 148 forks source link

[Crash] Thread 1: EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0) #159

Open MariyanskiDev opened 2 years ago

MariyanskiDev commented 2 years ago

Hello there! I have a section:

final class SomeSection: NSCollectionLayoutSection {

    convenience init() {
        let estimatedWidth: CGFloat = 100
        let itemSize = NSCollectionLayoutSize(widthDimension: .estimated(estimatedWidth),
                                              heightDimension: .absolute(30))
        let item = NSCollectionLayoutItem(layoutSize: itemSize)
        item.edgeSpacing = NSCollectionLayoutEdgeSpacing(leading: nil,
                                                         top: nil,
                                                         trailing: .fixed(8),
                                                         bottom: nil)
        let groupSize = NSCollectionLayoutSize(widthDimension: .estimated(estimatedWidth),
                                               heightDimension: .absolute(30))
        let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize,
                                                       subitems: [item])

        self.init(group: group)

        orthogonalScrollingBehavior = .continuous

        interGroupSpacing = 8

        contentInsets = NSDirectionalEdgeInsets(top: 12,
                                                leading: 16,
                                                bottom: 0,
                                                trailing: 0)
    }
}

And I got crash on iOS < 13:

Снимок экрана 2022-04-29 в 10 06 48