Invalid parameter not satisfying: indexPath || ignoreInvalidItems

I'm converting my collection view to new iOS13 UICollectionViewDiffableDataSource... so I need to update cell information on demand.

Here is my code:

let snap = self.diffDataSouce.snapshot 
snap?.reloadItems(withIdentifiers: [itemToUpdate]) //reload cell info
self.diffDataSouce.apply(snap, animatingDifferences: true)

But I get

Invalid parameter not satisfying: indexPath || ignoreInvalidItems
...why? My current
snap
contains
itemToUpdate
and also my array of models...


I think it's because

snap.indexOfItemIdentifier(itemToUpdate)
returns not found (NSNotFound)...but that's should be impossible according data model.


Have you some hints?

You do not tell how you build

diffDataSouce.

That could be the issue.


Without this info, I can just propose a complete example, for you to compare with what you did.


h ttps://wwdcbysundell.com/2019/diffable-data-sources-first-look/

Hi, did you manage to resolve this? I'm having the same problem in snapshot tests.

Invalid parameter not satisfying: indexPath || ignoreInvalidItems
 
 
Q