I’ve a horizontal UICollectionView displaying customers.
After I take away the present person, I additionally take away a picture from one other array, then name deleteItems(at:) to replace the gathering view.
let indexPath = IndexPath(merchandise: acIndex, part: 0)
exploreUsers.take away(at: acIndex)
arr_image.take away(at: acIndex)
col_exploreUser.deleteItems(at: [indexPath])
The primary deletion works tremendous, but when I name this a number of instances in a row (for instance, deleting a number of customers in sequence), the app crashes with:
*** Assertion failure in -[UICollectionView _Bug_Detected_In_Client_Of_UICollectionView_Invalid_Batch_Updates:], UICollectionView.m:10798
What I attempted:
Wrapping it in performBatchUpdates:
col_exploreUser.performBatchUpdates({
col_exploreUser.deleteItems(at: [indexPath])
}, completion: nil)
However I nonetheless get the identical crash when deleting a number of gadgets.
Including delays between deletions — nonetheless crashes finally.
Calling reloadData() after delete — removes crash however kills animation.