Я протестировал один и тот же код на двух реальных устройствах (iPhone и iPad) и получил два разных макета. Может ли кто-нибудь объяснить эту разницу?
Вот мой код:
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
ZStack {
Color.yellow
VStack{
Spacer()
Text("Content View").font(.largeTitle)
Spacer()
NavigationLink(destination:SecondView()) {
Text("Go to Detail View").font(.largeTitle)
}
Spacer()
}
}.edgesIgnoringSafeArea(.all)
}
}
}
struct SecondView: Просмотр {var body: some View {
NavigationLink(destination:ContentView()) {
ZStack {
Color.green
.edgesIgnoringSafeArea(.all)
VStack{
Spacer()
Text("Detail View").font(.largeTitle)
Spacer()
NavigationLink(destination:ContentView()) {
Text("Go to Content View").font(.largeTitle)
}
Spacer()
}
}.edgesIgnoringSafeArea(.all)
}
}
}
Экраны iPad:

Экраны iPhone:
