Open zizlak opened 3 years ago
Hi @zizlak
Just want to be sure that I understand the problem, you tried to delete the data and then call .deleteItems(at: [IndexPath])
and the gifs are not updated correctly?
Hi @TaLinh Yes, exactly.
It looks like the animator array is not in sync with the tableView/collectionView data. Can you share the code you're using to update the array?
That is the problem: I just delete the item in collectionView:
Persistancy.context.delete(item)
Persistancy.saveContext()
self.collectionView.filteredItems = FilterTags.shared.filteredItems
self.collectionView.deleteItems(at: [indexPath])
And the array is not being updated because the function collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) is not being called.
I tried to update the array mannualy:
for index in self.collectionView.animators.keys.sorted() {
if index.item >= indexPath.item {
let next = IndexPath(index: index.item + 1)
self.collectionView.animators[index] = self.collectionView.animators[next]
self.collectionView.animators[index]?.startAnimation()
}
}
But in that case, animation doesn't start automatically, only after scrolling. I thought there is some other default solution.
Hello, there is an issue when function .deleteItems(at: [IndexPath]) called - it is necessary to call .reloadData() to update gifs correctly; but in that case we lost this smooth animation of deleting the item or row. Is it possible to move cells and update their content without calling reloadData()?