jessesquires/ReactiveCollectionsKit

[DataSource] implement section index titles

Opened this issue · 0 comments

Docs: https://developer.apple.com/documentation/uikit/uicollectionviewdatasource#2851612

optional func indexTitles(for collectionView: UICollectionView) -> [String]?

optional func collectionView(_ collectionView: UICollectionView,  indexPathForIndexTitle title: String, at index: Int) -> IndexPath

This will need to be implemented at the CollectionViewModel level.

Maybe we wrap this functionality in a new protocol, pass that in, then call these methods via the data source implementation.

Rough example:

protocol IndexTitleViewModel {

    var indexTitles: [String]? { get }
    
    func indexPathForIndexTitle(_ title: String, at index: Int) -> IndexPath
}