Appear animation transition View for SwiftUI
Using Swift Package Manager
Swift Package Manager is a tool for managing the distribution of Swift frameworks. It integrates with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
To integrate using Xcode 13, open your Project file and specify it in Project > Package Dependencies
using the following URL:
https://github.com/stonko1994/DelayedTransitionView.git
import DelayedTransitionView
Add a DelayedTransitionView
to your view. This view acts as container view for all views that should be animated.
DelayedTransitionView {
...
}
The DelayedTransitionView
takes additional configuration properties. (See code documentation for details)
Use the .delayedPresentation(viewIndex: x)
view modifier to specify which views should be animated.
DelayedTransitionView {
VStack {
Spacer()
Text("First view")
.delayedPresentation(viewIndex: 0)
Spacer()
Text("Second view")
.delayedPresentation(viewIndex: 1)
Spacer()
Text("Third view")
.delayedPresentation(viewIndex: 2)
Spacer()
}
}
In this example only the Text
views will appear be animated.
For more control over the individual animations, checkout the additional configuration properties. (See code documentation for details)
It is possible to use the same viewIndex
for multiple views if they should appear at the same time. Also it does not need to start with 0