๐Ÿ“ฆNavigationLink

โŸฉ

SwiftUI โŸฉ navigation โŸฉ NavigationLink

A SwiftUI built-in view that navigates to a destination view when tapped by a user.

NavigationLink only works inside a NavigationStack or a NavigationSplitView.

// โญ๏ธ text label
NavigationLink("label") { 
    DestinationView()
        .navigationTitle("Destination View") 
}

// โญ๏ธ label (view builder)
NavigationLink(destination: DestinationView()) { 
    LabelView() 
}

// โญ๏ธ destination/label (view builder)
NavigationLink { 
    DestinationView() 
} label: { 
    LabelView() 
}

Last updated