I'm working on a very simple app in SwiftUI and I have managed to create a NavigationButton for my List that takes me to the DetailViewController. In the up right corner I wanted to have a "+" button to add things to my List:
navigationBarItems(trailing:
NavigationButton(destination: DetailVC()) {
Image(systemName: "plus")
.resizable()
.frame(width: 20, height: 20)
}
)
The problem is that when I tap on the button it doesn't navigate to my DetailVC.
I also tried this:
.navigationBarItems(trailing:
PresentationButton(destination: DetailVC()) {
Image(systemName: "plus")
.resizable()
.frame(width: 20, height: 20)
}
)
With this code the problem is that it doesn't present the DetailVC with a "Back" button, but it shows up from the bottom and there is no way to go back in my ContentView
What is the correct item to put in the navigation bar to navigate correctly?
Thank you, Nico
NavigationView { ... }
? – Heisenberg