There is one problem that I canβt seem to resolve. If you tap on some cells to mark them as deleted, and then tap on Done without deleting them, the next time you go in to Edit mode. one or more of those cells will show as selected for deletion. Very strange.
I had the same problem. It is caused by UIImageView of that cell kept the checked checkmark image when you select the cell on runtime.
I solved this by changing the UIImage of the UIImageView back to unchecked when the edit mode is false. This is under the collectionCellView class.
I thought you could add the following code to setEditing(_:animated:) and it would work but indexPathsForSelectedItems does not return all the selected items in the setEditing method (try printing the count). always returns 1 item for me.
collectionView.indexPathsForSelectedItems?.forEach({ (index) in
collectionView.deselectItem(at: index, animated: true)
})