Structure¶
DefaultNavigationViewStyle¶
The default navigation view style.¶
Declaration¶
struct DefaultNavigationViewStyle : NavigationViewStyle
Overview¶
Use this style with the navigationViewStyle(_:) modifier to set a NavigationView to use the default style given the context.
On iOS and Mac Catalyst, StackNavigationViewStyle is the default:
struct ExampleView: View {
var destination: some View {
Text("I'm stacked on the pancakes 📚")
.navigationTitle("Second Screen")
}
var body: some View {
NavigationView {
NavigationLink(destination: destination) {
Text("Stack the second screen! 🥞")
}
}
.navigationViewStyle(DefaultNavigationViewStyle())
}
}

On macOS, DoubleColumnNavigationViewStyle is the default:
struct ExampleView: View {
var destination: some View {
Text("I just appeared in the middle 🤠")
.navigationTitle("Second Screen")
}
var body: some View {
NavigationView {
NavigationLink(destination: destination) {
Text("I'm in the sidebar ⬅️")
}
}
.navigationViewStyle(DefaultNavigationViewStyle())
}
}

Availability¶
iOS 13.0+
macOS 10.15+
tvOS 13.0+
watchOS 7.0+
Topics¶
Initializer¶
init() Creates a default navigation view style.