import SwiftUI
struct MainScreen: View {
var body: some View {
TabView {
Text("First")
.tabItem {
Image(systemName: "map")
Text("First")
}
.toolbarBackground(.visible, for: .tabBar)
List {
ForEach(0..<5) { index in
Text("Item \(index + 1)")
}
}
.tabItem {
Image(systemName: "flag")
Text("Second")
}
.toolbarBackground(.automatic, for: .tabBar)
}
}
}
struct MainScreen_Previews: PreviewProvider {
static var previews: some View {
MainScreen()
}
}
Why the background of Second TabItem is not automatic? But it is affected by the configuration of First TabItem?