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:
@@ -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 }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user