How to handle UICollectionView reloadData with selected index path

Issue #434

When calling collectionView.reloadData(), selected indexpath stays the same, but be aware that order of data may have changed

1
2
3
4
5
6
7
8
let selectedData = ...
let indexPathForSelectedData = ...

collectionView.scrollToItem(
at: indexPathForSelectedData,
at: .centeredHorizontally,
animated: false
)

Comments