Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX attempt to delete and reload the same index path #279

Merged
merged 1 commit into from
Jun 30, 2020
Merged

FIX attempt to delete and reload the same index path #279

merged 1 commit into from
Jun 30, 2020

Conversation

knox
Copy link
Contributor

@knox knox commented Jun 30, 2020

Closes #274

@mikaoj
Copy link
Owner

mikaoj commented Jun 30, 2020

Awesome dude!

Looking at the documentation: https://developer.apple.com/documentation/photokit/phobjectchangedetails it looks like I've been using changedIndexes wrong

Warning
Don't map changedIndexes directly to UICollectionView item indices in batch updates. Use these indices to reconfigure the corresponding cells after performBatchUpdates(_:completion:). UICollectionView and UITableView expect the changedIndexes to be in the before state, while PhotoKit provides them in the after state, resulting in a crash if your app performs insertions and deletions at the same time as the changes.

So the proper fix should probably be to apply the changedIndexes after performBatchUpdates with inserted/deleted has been run.

Would you mind trying that fix out instead?

@knox
Copy link
Contributor Author

knox commented Jun 30, 2020

Thanks for pointing me to the docs 😊 I've force-pushed another approach

@mikaoj
Copy link
Owner

mikaoj commented Jun 30, 2020

LGTM

@mikaoj mikaoj merged commit ea58332 into mikaoj:master Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants