30. SwiftUI Animation and Transitions
This chapter is intended to provide an overview and examples of animating views and implementing transitions within a SwiftUI app. Animation can take a variety of forms including the rotation, scaling and motion of a view on the screen.
Transitions, on the other hand, define how a view will appear as it is added to or removed from a layout, for example whether a view slides into place when it is added, or shrinks from view when it is removed.
30.1 Creating the AnimationDemo Example Project
To try out the examples in this chapter, create a new Single View App Xcode project named AnimationDemo with SwiftUI enabled.
30.2 Implicit Animation
Many of the built-in view types included with SwiftUI contain properties that control the appearance of the view such as scale, opacity, color and rotation angle. Properties of this type are animatable, in that the change from one property state to another can be animated instead of occurring instantly. One way to...