In SwitUI when using a map within a tabview the tab bar color is translucent when the map tab is selected. All of the other tabs the tab bar is opaque. In the view that contains the map, if the map is commented out the tab display is opaque, only when the map is displayed. I have an init in the tabview to set the tab bar parameters: // Set Tab Bar appearance let tabbarAppearance = UITabBarAppearance() tabbarAppearance.configureWithOpaqueBackground() tabbarAppearance.backgroundColor = .blue UITabBar.appearance().standardAppearance = tabbarAppearance UITabBar.appearance().scrollEdgeAppearance = tabbarAppearance
In the view with the map I use a ZStack to set the entire screen color:
ZStack(alignment: Alignment(horizontal: .center, vertical: .top)) {
Color(.blue)
.ignoresSafeArea(.all)
.foregroundColor(.black)
VStack(alignment: .center, spacing: 5) {
Spacer()
Map()
Spacer()
}
}
I've tried using .padding(), frame, removing ignoresSafeArea but the tab bar still becomes translucent when the tab is selected. Selecting another tab the color becomes opaque.
Any suggestions on how to correct this behavior so the tab bar is opaque for all tabs?