From b6c90a4177d0788c97c43c0dd15789be382f4631 Mon Sep 17 00:00:00 2001 From: kutesir Date: Fri, 29 May 2026 11:01:58 +0300 Subject: [PATCH] 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. --- KisaniCal/ContentView.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/KisaniCal/ContentView.swift b/KisaniCal/ContentView.swift index 3d4ae77..811824f 100644 --- a/KisaniCal/ContentView.swift +++ b/KisaniCal/ContentView.swift @@ -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 } }