UICollectionView update is not instant and smooth

Viewed 104

Faced such a problem while deleting an element from a CollectionView. The text in a cell does not update immediately. It disappears and is replaced with a ~0.5 delay.

I am using collectionView.reloadSections(IndexSet(integer: 0)) for updating the view. I also tried to use collectionView.reloadData(), but it is even worth. The animation is flashing. Tried to use code like this

      collectionView.performBatchUpdates({
        self.collectionView.deleteItems(at: [indexPath])
    }, completion: {
        (finished: Bool) in
        self.collectionView.reloadItems(at: self.collectionView.indexPathsForVisibleItems)
    })

but the result was not satisfying. The animation behaved weird.

Also does collectionView.deleteItems(at:[IndexPath]) not give me what i want. What else would you suggest me to try? Thanks!

enter image description here

0 Answers
Related