Crash on `updateConfiguration` method
stephenyao opened this issue · comments
We're using this component and getting the occasional crash upon calling updateConfiguration
inside the InfiniteScrollingBehavior
class.
The scenario is as we have a vertically scroll UICollectionView
where each cell in the collection view contains another collection view that uses the InfiniteScrollingBehaviour
class. Each time we deque and reuse a cell we need to call updateConfiguration
on the InfiniteScrollingBehavior
, and this is where the crash occurs. We can't reproduce it 100% of the time, but it happens frequently enough that it would blow up in production if we were to release it.
I'm suspecting that
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
self.collectionView.reloadData()
self.scrollToFirstElement()
}
is causing the problem. May I ask, why you have used a asyncAfter
call, rather than just a async
? Also, why do we need to use DispatchQueue.main
at all, as the InfiniteScrollingBehavior
doesn't perform updateConfiguration
on a background queue?