Fix FloatingTabState crash + landscape layout on iPhone

Use UIDevice.userInterfaceIdiom instead of hSizeClass so large iPhones
in landscape keep the iPhone layout. Move tabState environmentObject to
the top-level Group so both layouts always have it in scope.
This commit is contained in:
kutesir
2026-05-29 11:01:58 +03:00
parent 8210cbf487
commit b6c90a4177

View File

@@ -61,14 +61,17 @@ struct ContentView: View {
}
}
private var isIPad: Bool { UIDevice.current.userInterfaceIdiom == .pad }
var body: some View {
Group {
if hSizeClass == .regular {
if isIPad {
iPadLayout()
} else {
iPhoneLayout()
}
}
.environmentObject(tabState)
.preferredColorScheme(preferredScheme)
.fullScreenCover(isPresented: $showOnboarding) {
OnboardingView(isPresented: $showOnboarding)
@@ -144,7 +147,6 @@ struct ContentView: View {
.padding(.horizontal, 24)
.padding(.bottom, 8)
}
.environmentObject(tabState)
.onAppear { UITabBar.appearance().isHidden = true }
}