Transitions
SwiftUI transitions allow you to animate the insertion and removal of views from the UI. To apply a transition to a view, we use the .
transition(_:)
modifier.
The basic transition types that SwiftUI provides include the following:
opacity
: This transition causes views to fade in or out when they’re inserted or removedscale
: This transition causes views to grow or shrink in size when they’re inserted or removedslide
: This transition causes a view to slide in or out from the edge of the screen when it is either added or removedmove(edge:)
: This transition moves a view in or out from the specified edge of the screenoffset(x:y:)
: This transition moves a view by the specified amount of typographical points when it is inserted or removed
By default, if you don’t specify a transition, iOS will apply a default transition when presenting (adding) or removing views from the screen. There are several default transitions available...