I'm trying to create two views (ContentView1, ContentView2), which both have a bottom bar. ContentView1 should navigate to ContentView2.
When I run the code below, the bottom bar button in contentView2 disappears.
Here's my code:
struct ContentView1: View {
var body: some View {
NavigationView {
Text("You are currently viewing ContentView1")
.navigationTitle("ContentView1")
.toolbar{
ToolbarItem(placement: .bottomBar){
NavigationLink("ContentView2", destination: ContentView2())
}
}
}
}
}
struct ContentView2:View {
var body: some View {
Text("You are current viewing ContentView2")
.navigationTitle("ContentView2")
.toolbar {
ToolbarItem(placement: .bottomBar) {
Text("Bottom Bar Text")
}
}
}
}
after navigating to ContentView2:
Why isn't the bottom bar text appearing? Thanks in advance