Group Group Group Group Group Group Group Group Group

Animation in chapter 26

#1

In chapter 26 you code
let hudView = HudView.hud(inView: navigationController!.view, animated: true)
hudView.text = “Tagged”

In the convenience method the HudView instance is added as a subview with animation.
Why is the text shown from the beginning of the animation? This property is set after initialization so after the subview was drawn?

#2

The animation is a closure. The call to show returns before the animation even starts. Actual drawing on screen is not synchronous with your code. Even without an animation, your code will finish before the actual drawing starts.