danielsaidi / BottomSheet

BottomSheet lets you add custom bottom sheets to your SwiftUI apps.
MIT License
190 stars 12 forks source link

On top of tabbar #12

Closed anonrig closed 2 years ago

anonrig commented 2 years ago

Hi @danielsaidi

Thank you for this fantastic library. I just had a question and wanted to ask here for future reference (and for SEO). How can I make sure that the bottomSheet is shown on top of the Tabbar?

danielsaidi commented 2 years ago

Hi @anonrig - thanks, big cred to Majid for the original concept :)

You can try out how this would behave, by wrapping the demo's ContentView content in a TabView:

var body: some View {
    TabView {
        NavigationView {
            ...
        }
    }
}

As you'll notice, the bottom bar will then overlap the tab view, which may not result in the best design:

image

However, IF you'd like to have a bottom sheet applied to a root tab view regardless, you have to replace the demo's ContentView state approach, with instead injecting state as binding values, so that the tab view content can control the outermost sheet by changing the binding values.