arnauddorgans / InfiniteLayout

Horizontal and Vertical infinite scrolling feature for UICollectionView with Paging, NSProxy delegate, Reactive extension, SectionModel & AnimatableSectionModel support
MIT License
516 stars 63 forks source link

UICollectionViewDataSourcePrefetching seems to be broken #26

Open jspavlick opened 3 years ago

jspavlick commented 3 years ago

func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) and func collectionView(_ collectionView: UICollectionView, cancelPrefetchingForItemsAt indexPaths: [IndexPath]) are called repeatedly with the same values, making it almost entirely useless.

Has anyone encountered this? Or am I using this library incorrectly?

berarduc commented 2 years ago

Yes I see the same problem with very large collections and when scrolling very fast. I get repeated calls to prefetch / cancel prefetch for the same indexpaths. I'm only scrolling in ONE direction, no reversals. Some indexpaths are included in these repeated calls 2 and 3 times which slows things down for no reason.