Currently i am reading very interesting book of Matt Neuburg. But i stuck on this moment:
In the simplest case, you’ll just launch the animation and stand back, as I demonstrated earlier:
let anim = UIViewPropertyAnimator(duration: 1, curve: .linear) { self.v.backgroundColor = .red } anim.startAnimation()
In that code, the UIViewPropertyAnimator object anim is instantiated as a local variable, and we are not retaining it in a persistent property; yet the animation works because the animation server retains it.
Did we ever need to retaining an animation in a persistent property when we using it in aforementioned way? Why animation (it seems in other cases) should not work if we do not retain it in a persistent property? I think i don not understand something who else read this book?