Hi guys,
I have a small problem with the following code. It works fine if the device is an iPhone (also simulator). If I use an iPad, the screen remains empty (also in the simulator). Where is the error? I can't find one at the moment.
import SwiftUI
struct ContentView: View {
let l = ["a", "b", "c"]
var body: some View {
NavigationView {
List {
ForEach (l, id: \.self) {l in
NavigationLink(destination: sv()) {
Text(l)
}.navigationBarTitle(Text("List"))
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
struct sv: View {
var body: some View {
Text("Hello, World!")
}
}
Thjere is effectively a problem on iPad.
Get a blank screen.
Both tested with XCode 11.2ß2 and 11.3. with simulator 13.2.
But in fact the view is just hidden.
If you drag from the left border to the right, you will see list appear !
Or if you rotate the device.
:or add a .navigationViewStyle
struct ContentView: View {
let l = ["a", "b", "c"]
var body: some View {
NavigationView {
List {
ForEach (l, id: \.self) {l in
NavigationLink(destination: sv()) {
Text(l)
}.navigationBarTitle(Text("List"))
}
}
}.navigationViewStyle(DoubleColumnNavigationViewStyle())
.padding()
}
}
https://stackoverflow.com/questions/57049384/swiftui-navigationview-on-the-ipad-pro