Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataSource] implement section index titles #3

Open
jessesquires opened this issue Oct 28, 2019 · 0 comments
Open

[DataSource] implement section index titles #3

jessesquires opened this issue Oct 28, 2019 · 0 comments

Comments

@jessesquires
Copy link
Owner

jessesquires commented Oct 28, 2019

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
}
@jessesquires jessesquires changed the title [DataSource] implement indexes [DataSource] implement section index titles Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant