Hi,
My UICollectionViewCell
has a subview UIImageView
, which has a mask CALayer
that I control and that I add animations to.
Recently, I noticed that the animation wasn't working and I was wondering why. I finally figured out that it depends on whether I apply my NSDIffableDataSourceSnapshot
animated or not.
The animation would only work as expected, if the snapshot is applied animated.
This raised a question: What happens if the snapshot is applied without animation? And why is it affecting CABasicAnimation on a CALayer?
I haven't found a solution for it yet, so I wanted to ask here in case anybody knows what's up.
imageView.layer.mask = animationLayer
animationLayer.removeAllAnimations()
let animation = CABasicAnimation(keyPath: "locations")
/// ...
animationLayer.add(animation, forKey: "shimmer")
This code runs when the cell is gathered from the collection view for an index path.
dataSource.apply(snapshot, animatingDifferences: false)
Is there any way to apply a snapshot without animation while keeping animations within the cell working correctly?
Thanks