Router
Router is a library that assists with SwiftUI view transitions.
Installation
Usage
Router
The Router
specifies the View to be navigated.
The argument of Router
is the Path of the first View to be displayed. By default, /
is specified.
Route
Route
will show the View of the Path specified in the argument.
Path has placeholders and the parameters can be accessed from context.
Navigator
It transitions between screens by giving Navigator
a path.
You can specify the transition animation. In the example below, we call the push animation.
Navigator is defined as an environment, so it can be called from anywhere.
Custom Transition Animation
To customize the transition animations, you must first extend AnyTransition.
Next, we will extend Binding<Navigator>
.
It can be called as follows