Afternoon All
I have a collection view with a simple custom layout (each cell is a simple image) and am getting errors when tryig to delete items, i.e. "assertion failure in -[UICollectionViewData validateLayoutInRect]" and then also "UICollectionView received layout attributes for an index ath that does not exist". The second error crashes the process.
I've created a very simple test, without custom layout, as follows:
// This works
items.remove(at: 0)
cv.deleteItems(at: [IndexPath(row: 0, section: 0)])
cv.reloadData()
This works fine. I've tried at least a dozen solutions I found online but nothing works. I've tried batch updates, setting delegates to nil and then resetting after the updates, invalidating the layout etc.
The error is almost always on the line "cv.deleteItems(at: [IndexPath(row: 0, section: 0)])", sometimes in the app delegate.
Does anyone have a simple checklist of what I'd need to do to get this working with custom layout?
Many thanks...