Hi! I'm working on a iOS 26 SwiftUI prototype that adds an element to the content of a screen only when the tab bar is fully visible and not minimized (via .tabBarMinimizeBehavior)
.
Is there any way to detect when a tab bar is minimized? My hope is that I can use a ternary operator to display something only when a boolean is true.
Here's some code to illustrate my idea:
struct ContentView: View {
@State var isTabBarMinimized: Bool = false
var body: some View {
TabView {
Tab("View1", systemImage: "rainbow") {
// Only appears when tab bar is fully visible
Color.blue
.opacity(isTabBarMinimized? 0 : 1 )
}
Tab("View2", systemImage: "rainbow") {
View2()
}
Tab("View3", systemImage: "rainbow") {
View3()
}
Tab("View4", systemImage: "rainbow") {
View4()
}
}
.tabBarMinimizeBehavior(.onScrollDown)
}
}