I insert new elements when the user views the collection view ... I have a problem if they scroll too quickly, viewing the collection stops scrolling when inserting new elements.
My initial problem was that I was just calling self.collectionView.reloadData()instead of performing batch updates, but currently doing the same thing ...
This is my code.
let postIndex = self.posts.count
let newPostIndex = newPosts.count
let indexArray = (postIndex...postIndex+newPostIndex-1).map{IndexPath(item: $0, section: 0)}
self.posts.append(contentsOf: newPosts)
self.collectionView.performBatchUpdates({
self.collectionView.insertItems(at: indexArray)
}, completion: nil)
I already have entries, so I create an array of indexes that I need to update and paste them into performBatchUpdates, but it looks very volatile and does not have a pleasant feeling.
CATransaction, qaru.site/questions/74612/..., , .
,