Beta 6.0
Pre-releaseTransition Screen
Details (Click to expand)
Use a screen transition to replace the current screen with a new one. This is not the same as a segue and will deallocate the first screen entirely. This changes the current view without affecting the surrounding view hierarchy.
router.transitionScreen(.leading) { router in
Text("Screen1.1")
}
router.transitionScreen(.trailing) { router in
Text("Screen1.2")
}
Dismiss most recent transition.
router.dismissTransition()
Dismiss all transitions to root.
router.dismissAllTransitions()
Transition Module
Details (Click to expand)
Modules are high-level containers for your app, where each module has it's own View hierarchy. This will change the entire hierarchy in your app, dismissing the root NavigationView as well as all screens displayed on top. Use this for things like "show onboarding" vs "show tabbar".
router.transitionModule(id: "onboarding", .leading) { router in
Text("Onboarding View")
}
router.transitionModule(id: "home", .trailing) { router in
Text("Home View")
}
The user's last module ID will persist across app sessions. This is returned when creating a RouterView
and can be used to restore the user's previous module.
RouterView(addNavigationView: true) { (router, lastModuleId) in
if lastModuleId == "home" {
Text("Home View")
} else {
Text("Onboarding View")
}
}
Multiple Modals
Details (Click to expand)
You can now display multiple modals simultaneously (previously 1). Modals have an optional ID, which can later be used to dismiss the modal.
router.showModal(id: "top1") {
Text("Sample")
}
// Dismiss top-most modal
router.dismissModal()
// Dismiss modal by ID
router.dismissModdal(id: String)
// Dismiss all modals
router.dismissAllModules()