I am trying to show a StackNavigationView for my app's menu if the user is on iPad and the default Navigation view elsewhere. The reason is because on iPad the default view only shows the back button and nothing else, and the user has to click the back button to access the menu in portrait mode, which is not user friendly at all. Here is a simplified version of my code
@State var selectedView:Int?;
@Environment(\.colorScheme) var colorScheme;
var body: some View {
ZStack{
NavigationView{
List{
NavigationLink(destination: textChangeView(){
Text("mOcK tExT")
}
NavigationLink(destination: textChangeView()) {
Text("S P A C E D")
}
NavigationLink(destination: textChangeView() {
Text("Windy text")
}
}
}.navigationTitle("Options")
// PROBLEM IS HERE
}.navigationViewStyle(UIDevice.current.model == "iPad" ? StackNavigationViewStyle() : DefaultNavigationViewStyle.automatic)
}
}
The official SwiftUI documentation tells us to use automatic which is an attribute of DefaultNavigationStyle. Yet, I get the error
Type 'DefaultNavigationViewStyle' has no member 'automatic'
How can I set up my navigationViewStyle to be StackNavigationStyle and the default elsewhere ?