Bring SwiftUI ButtomSheet behind tab bar
Asked Answered
M

1

7

I want to use the new iOS 16 Buttom Sheet Feature to create a view like the find my:

enter image description here

Unfortunately the TabView gets hidden behind the Sheet:

enter image description here

My Code:

           TabView {
            Text("View 1")
                .sheet(isPresented: .constant(true)) {
                    Text("Sheet View Content")
                        .presentationDetents([.medium, .large])
                }
                .tabItem {
                    Label("Menu", systemImage: "list.dash")
                }
        
            Text("View 2")
                .tabItem {
                    Label("Order", systemImage: "square.and.pencil")
                }
        }

How can I achieve this?

Mendive answered 22/10, 2022 at 9:7 Comment(1)
I would try to put text and sheet in a VStack. So the sheet is not associated with the tabview but the VStackMotteo
B
5

No Solution for the moment

Unfortunately, it is not currently possible to show a modal sheet with a tab bar visible using the current version of SwiftUI. This issue has been raised by other developers on the Apple developer forums and on other threads on StackOverflow, such as the following:

I am also searching for a solution to this problem.

I am currently working on a custom ViewModifier to address this issue, and if it is successful, I will make it publicly available on GitHub.

Butta answered 17/1, 2023 at 15:54 Comment(1)
@Butta - Do you have it working?Blemish

© 2022 - 2025 — McMap. All rights reserved.