SwiftUI double navigation bar
Remove the NavigationView
from SecondView
.
The NavigationLink
puts the second view inside the first views navigations view, so you do not need to put it inside a second one.
You can still update the title of the view from SecondView
like so:
struct SecondView: View {
var body: some View {
Text("My View")
.navigationBarTitle("Second View")
}
}
Quinn is right. but if You don't want a big area above:
add:
struct SecondView: View {
var body: some View {
Text("My View")
.navigationBarTitle("Second View", displayMode: .inline)
}
}