Reputation: 39
I'm trying to change the color of my toolbar. I found the code
.toolbarBackground(Color.blue, for: .navigationBar)
and tried to place it in different position in my code but without any success.
here is an example code with my bottombar. I would like to change the color of my bottom bar
truct ContentView: View {
var body: some View {
NavigationStack {
VStack {
Text("Test")
.toolbar{
ToolbarItemGroup(placement: .bottomBar){
Spacer()
NavigationLink(destination: SecondView()) {
Image(systemName: "bag")}
Spacer()
NavigationLink(destination: SecondView()) {
Image(systemName: "dollarsign.circle")}
Spacer()
NavigationLink(destination: SecondView()) {
Image(systemName: "plus.circle")}
Spacer()
NavigationLink(destination: SecondView()) {
Image(systemName: "minus.circle")}
Spacer()
}
}
.toolbarBackground(Color.blue, for: .bottomBar)
}
}
}
}
could you please point me in the right direction?
Upvotes: 2
Views: 264
Reputation: 71
I think you need to add:
.toolbarBackground(.visible, for: .navigationBar)
Upvotes: 0