SwiftUI: how to change NavigationView.toolbar background color
Solution 1:
You can do this using UIToolbar
appearance. Tested with Xcode 12 / iOS 14.
struct DemoView: View {
init() {
UIToolbar.appearance().barTintColor = UIColor.red
}
var body: some View {
NavigationView {
List {
Text("Item")
}
.toolbar {
ToolbarItem(placement: .bottomBar) {
Button(action: { }, label: {Text("ITEM1")})
}
ToolbarItem(placement: .bottomBar) {
Button(action: { }, label: {Text("ITEM2")})
}
ToolbarItem(placement: .bottomBar) {
Button(action: { }, label: {Text("ITEM3")})
}
}
}
}
}