I want a two column-view in a Swift UI app, where the left column displays a list and the right column displays a detail view. This works fine like this:
struct ContentView: View {
@State private var columnVisibility = NavigationSplitViewVisibility.doubleColumn
var body: some View {
NavigationSplitView( columnVisibility: $columnVisibility) {
List {
ForEach(itemList, id: \.self ){item in
NavigationLink(item.name){ ItemDetail(item: item)}
}
} } detail: {
Text("detail placeholder ")
}
.navigationSplitViewStyle(.automatic)
}
}
In iPad portrait mode I want to show only the list column first. This should then behave like a stack navigation.
In addition, on the Mac, if a certain window width is not reached, only the list column should be displayed. This should then also behave like a stack navigation.
How is this feasible?