ra1028 / DiffableDataSources

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

Add subscript function for SectionIdentifierType #17

Closed RalfK92 closed 4 years ago

RalfK92 commented 4 years ago

Checklist

Description

We want to have a getter function for the SectionIdentifierType, to be able to use different cell types depending on the section they are in.

Motivation and Context

We want to use IBPCollectionViewCompositionalLayout with different layouts per section. IBPCollectionViewCompositionalLayout refers to this datasource library. In the current implementation we were not able to achieve that because of the missing getter for the SectionIdentifierType.

Proposed Solution

Adding a subscript function for the SectionIdentifierType.

ra1028 commented 4 years ago

@RalfK92 Sorry for my late reply.

Unfortunately, it's not even in the original UICollectionViewDiffableDataSource. I think you can get it from the snapshot.

dataSource.snapshot().sectionIdentifiers