With NavigationView
being the root of UIHostingController
, the below code shows split view for iPad.
struct ContentView: View {
var body: some View {
NavigationView {
Text("Hello")
.navigationBarTitle("Home")
}
}
}
With the above code it shows split view on iPad. How can I still use the NavigationView
and get rid of split view for iPad , as I am looking to have a List and on tap of which it should push another view?
Use stack navigation view style explicitly (by default it is platform-dependent)
NavigationView {
Text("Hello")
.navigationBarTitle("Home")
}
.navigationViewStyle(StackNavigationViewStyle())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With