iosswiftuiuitabbarcontrollertabbar

SwiftUI TabBar show translucent effect even when scroll is over


iOS TabBar automatically shows a blurry effect when items scroll behind it, as shown in the image:

enter image description here

but once the content view scrolls to the bottom, the background goes transparent:

enter image description here

Is there any way to make the TabBar always fully visible including the translucent / blurry background?


Solution

  • You just need to apply .toolbarBackground(.visible, for: .tabBar) to the content inside the TabView:

    TabView {
        Text("MyView")
            .toolbarBackground(.visible, for: .tabBar)
            .tabItem { Label("One", systemImage: "1.circle") }
    }
    

    Screenshot