Hi there!
I need advice how to dynamically change collection view cell's size.
I'm using UICollectionViewCompositionalLayout and UICollectionViewDiffableDataSource to build my collection view.
There are several subviews in the cell and one of that is hidden by default. I need to expand selected cell and show this hidden view.
After selecting a cell I update the cell model (which makes the hidden subview visible) and create a new snapshot. Then apply this snapshot:
dataSource.apply(currentSnapShot, animatingDifferences: true)
I see a short animation of the cell opening, and then it returns to its previous size until I scroll through the collection and return to this cell.
I tried to manually reload data in a completion handler
dataSource.apply(currentSnapShot, animatingDifferences: true) {
self.collectionView.reloadData()
}
but it didn't help.
What should I do to see final state after selecting the cell?
Thanks