I am trying to play animation after reload data in collection view but it seems to be impossible, it only appears on initial load. It is normal or I should I reset it after reload data? If so, how?
collectionView.reloadData isn't a transition. Therefore isn't handled by Hero. Such animation can be built from collectionDelegate callback. https://developer.apple.com/reference/uikit/uicollectionviewdelegate/1618087-collectionview
`override func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
if shouldTransitionCells {
cell.transform = CGAffineTransform(translationX: cellWidth, y:0)
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.5, options: .curveEaseInOut, animations: {
cell.transform = .identity
}, completion: { (finished) in
if self.collectionView!.visibleCells.count >= indexPath.row-1 {
self.shouldTransitionCells = false
}
})
}
}`
any changes?