How do you link an About navigation bar button to an About View? I have seen a number of posts on how to add a button to the navigation bar, but nothing on how to handle a link to the view.
struct ContentView: View {
var body: some View {
NavigationView {
VStack {
NavigationLink(destination: m1View()) {
Text("Menu 1")
}
.padding()
NavigationLink(destination: m2View()) {
Text("Menu 2")
}
.padding()
NavigationLink(destination: m3View()) {
Text("Menu 3")
}
.padding()
}
.font(.title)
.navigationBarTitle("Main View", displayMode: .inline)
.navigationBarItems(trailing: Button(action: {
// TODO: add about link here
}) {
Text("About")
}
)
.onAppear(perform: loadDataViaBankApi)
}
}
func loadDataViaBankApi() -> () {
...
}
}
Here is possible solution - in navigation bar only activate link, but place link inside navigation view