Wrap the TabView with NavigationView and add the navigationBarTitle to each TabView Item.
Example
struct ContentView: View {
@State var selectedTab: Int = 0
var body: some View {
NavigationView {
TabView(selection: $selectedTab, content: {
TabOneView()
.tabItem{Image(systemName: "pencil")}
.tag(0)
.navigationBarTitle("", displayMode: .inline)
.navigationBarHidden(true)
TabTwoView()
.tabItem{Image(systemName: "bookmark")}
.tag(1)
.navigationBarTitle("", displayMode: .inline)
.navigationBarHidden(true)
})
}
}
}
struct TabOneView: View {
var body: some View {
NavigationLink(destination: Text("Tab 1 detail view")) {
Text("Tab 1 view")
}
}
}
struct TabTwoView: View {
var body: some View {
NavigationLink(destination: Text("Tab 2 detail view")) {
Text("Tab 2 view")
}
}
}