📦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()
}Design+Code - Navigation Link and URL
Hacking with Swift - What’s new in Swift 5.3? (multiple trailing closures)
Sarunw - tintColor in SwiftUI
Last updated
Was this helpful?