When animating the addition of cells to a UICollectionView
, we may notice that text and background colours arenβt animating when using UIView.animate
. Using UIView.transition
instead works perfectly! π
UIView.transition(with: commentContainer, duration: 0.6,
options: .transitionCrossDissolve, animations: {
commentContainer.backgroundColor = UIColor(red: 17, green: 215, blue: 198)
})
UIView.transition(with: commentLabel, duration: 0.6,
options: .transitionCrossDissolve, animations: {
commentLabel.textColor = UIColor(red: 143, green: 155, blue: 174)
})
Thanks for reading and happy coding! π