跳转至
Structure

DoubleColumnNavigationViewStyle

A navigation view style represented by a primary view stack that navigates to a detail view.

Declaration

struct DoubleColumnNavigationViewStyle : NavigationViewStyle

Overview

Use this style with the navigationViewStyle(_:) modifier to set a NavigationView to use the double column style.

This is the default behavior in macOS, and works well in iPadOS. In iOS, it is overriden and StackNavigationViewStyle is used instead.

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(DoubleColumnNavigationViewStyle())
    }
}
A gif displaying a double-column style NavigationView with a NavigationLink reading "I'm in the sidebar ⬅️" in the left column that once clicked results in the appearance of the text view "I just appeared in the middle 🤠" with the navigation title "Second Screen" in the right column.

Availability

iOS 13.0+

macOS 10.15+

tvOS 13.0+

Topics


Initializer

init() Creates a double column navigation view style.