Reputation: 135
I just create a swiftUI project and type this code on CntentView.swift. But the result is this image below. It was the same when I tried to run it on a real machine. Why?
Environment: Xcode Version 12.2(12B45b),
This is code of "Test13App.swift". Not edited any line.
Thank you very much for your comments. Since I only have iPad pro (and not have iPhone), I just knew this is a default behaviour of iPad split view now by your comments. Adding .navigationViewStyle(DefaultNavigationViewStyle()) right after NavigationView solved the problem like this SwiftUI NavigationView on the iPad Pro
Sorry and Thanks very much!
Upvotes: 3
Views: 993
Reputation: 11
When focused on both iPhone and iPad devices some developer's missing set the navigationview style type.
Upvotes: 0
Reputation: 77
If you want to change the style of your NavigationView on iPad making it similar to iPhone, you could use the:
.navigationViewStyle(StackNavigationViewStyle())
option in your NavigationView
.
Like this:
struct ContentView: View {
var body: some View {
NavigationView{
Text("prova")
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
Upvotes: 4