JetNavigation
An alternative SwiftUI NavigationView.
import JetNavigation
struct RootView: View {
var body: some View {
JetNavigationView {
FirstExample()
}
}
}
struct FirstExample: View {
var body: some View {
ZStack {
Color.green
JetNavigationLink(destination: SecondExample()) {
Text("Go to Second")
}
}
}
}
struct SecondExample: View {
var body: some View {
ZStack {
Color.red
JetNavigationLink(action: .back) {
Text("Back")
}
}
}
}
JetNavigationExternalController
Allows you to control navigation outside of the JetNavigationView
class ExternalController: JetNavigationExternalController, ObservableObject {
var jetNavigationController: AnyObject?
}
struct RootView: View {
@StateObject
var externalController:
ExternalController = .init()
var body: some View {
VStack{
JetNavigationView(externalController: externalController) {
FirstExample()
}
//External button for control
Button {
self.externalController.home()
} label: {
Text("Go to home")
}
}
}
}