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 prefetching #18

Open
jessesquires opened this issue Nov 29, 2019 · 0 comments
Open

[DataSource] implement prefetching #18

jessesquires opened this issue Nov 29, 2019 · 0 comments

Comments

@jessesquires
Copy link
Owner

jessesquires commented Nov 29, 2019

Discussion

Initial thoughts:

  • Create a new DataPrefetchAdapter class that conforms to UICollectionViewDataSourcePrefetching
    • This should map the prefetch API index paths to identifiers
    • Tell the client "preload these identifiers"
    • Maybe have clients pass in closures or something?
  • Pass this object into CollectionViewDriver and hook it up to the collectionView.prefetchDataSource
  • Allow client to provide a prefetching queue

Potential problems

  • CollectionViewModel is designed to be stateless, so maybe this just doesn't make sense?
  • When prefetching operations complete, we need a way to say "ok, now update the collection view."
  • Would this involve needed to regenerate the CollectionViewModel? Would CellViewModel instances be mutable?

Docs

Sample Code

This sample code is pretty interesting. They use NSOperationQueue or DispatchQueue. There's lots of boilerplate there that we should attempt to encapsulate. Clients can give us a queue, or we can maintain our own.

@jessesquires jessesquires changed the title [DataSource] implement prefetching? [DataSource] implement prefetching? (probably not) Nov 29, 2019
@jessesquires jessesquires changed the title [DataSource] implement prefetching? (probably not) [DataSource] implement prefetching? May 24, 2024
@jessesquires jessesquires changed the title [DataSource] implement prefetching? [DataSource] implement prefetching May 24, 2024
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