Hi Claude,
thanks the links helped to solve(?) workaround(?) the issue. I'll add a minimalist example below for reference, if somebody else stumbles across this (or similar) issues. Seems like a bug to me... (FB7581633)
| import SwiftUI |
| |
| struct ContentView: View { |
| var body: some View { |
| NavigationView { |
| List { |
| NavigationLink(destination: Detail()) { |
| Text("Tap here") |
| } |
| } |
| } |
| .navigationViewStyle(StackNavigationViewStyle()) |
| } |
| } |
| |
| struct Detail: View { |
| var body: some View { |
| NavigationView { |
| GeometryReader { geo in |
| if geo.size.height > geo.size.width { |
| self.portrait |
| .frame(width: geo.size.width, height: geo.size.height) |
| } else { |
| self.landscape |
| .frame(width: geo.size.width, height: geo.size.height) |
| } |
| } |
| } |
| .navigationBarTitle(LocalizedStringKey("Edit entry")) |
| } |
| |
| var portrait: some View { |
| VStack { |
| Text("This is portrait. Crashes if Geometry reader is not wrapped in a NavigationView.") |
| } |
| } |
| |
| var landscape: some View { |
| HStack { |
| Text("This is landscape. Works.") |
| } |
| } |
| } |
Cheers, Michael