DiffableDataSources icon indicating copy to clipboard operation
DiffableDataSources copied to clipboard

Missing section identifier in UICollectionViewDelegate methods when deleting sections

Open absoftware opened this issue 4 years ago • 1 comments

Checklist

  • [YES] Reviewed the README and documents.
  • [YES] Searched existing issues for ensure not duplicated.

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 avatar Dec 07 '20 12:12 absoftware

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

absoftware avatar Dec 07 '20 12:12 absoftware