I have such a code and I can't set up navigation
struct ContentView: View {
var body: some View {
TabView{
RootView(title: "Main")
.tabItem{
Image(systemName: "house")
}
RootView(title: "Messages")
.tabItem{
Image(systemName: "message")
}
}
}
}
struct RootView: View{
let title: String
var body: some View{
NavigationView{
List{
ForEach(0..<10, id: \.self){index in
NavigationLink(destination: {
Text("123")
}, label: {
Text("\(index)")
})
}
NavigationLink(destination: {
Text("This is new window")
}, label: {
Text("New window")
})
}
.navigationTitle(title)
}
}
}
Can I do this on SwiftUI 4 so that when I click on a "New Window" list item, that item opens on top of the TabView in a new window? But so that all the other elements of the list open inside the TabView