Create a NavigatableView
mainTo make a view eligible to be pushed onto the navigation stack, conform it to the NavigatableView protocol. You must implement the body property and can optionally implement configure(view: NavigationConfig) -> NavigationConfig to customize the view's appearance (e.g., background color).
struct ExampleView: NavigatableView {
// Optional: Customize view appearance
func configure(view: NavigationConfig) -> NavigationConfig {
view.backgroundColour(.red)
}
var body: some View {
VStack(spacing: 0) {
Text("Witaj okrutny świecie")
Spacer()
Button(action: pop) { Text("Pop") }
}
}
}struct ExampleView: NavigatableView {
func configure(view: NavigationConfig) -> NavigationConfig {
view.backgroundColour(.red)
}
var body: some View {
VStack(spacing: 0) {
Text("Witaj okrutny świecie")
Spacer()
Button(action: pop) { Text("Pop") }
}
}
}