ra1028 / DiffableDataSources

💾 A library for backporting UITableView/UICollectionViewDiffableDataSource.
https://ra1028.github.io/DiffableDataSources
Apache License 2.0
845 stars 68 forks source link

Missing section identifier in UICollectionViewDelegate methods when deleting sections #33

Open absoftware opened 3 years ago

absoftware commented 3 years ago

Checklist

Description

When it's called just after applying deleted section

    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {

        // it crashes when it's called just after applying deleted section
        let sectionIdentifier1 = self.dataSource.snapshot().sectionIdentifiers[section]

        // it would be nice to have sth like this as data source is still correct when snapshot actually isn't
        let sectionIdentifier2 = self.dataSource.sectionIdentifier(for: section) 

        // I need to know which section is here
    }

then it crashes or it's not possible to get section identifier in UICollectionViewDelegate methods.

absoftware commented 3 years ago

I reported PR for this: https://github.com/ra1028/DiffableDataSources/pull/34