I'm seeing unexpected behavior with the SwiftUI Toolbar. This code works but the items are grouped together in the center of the toolbar (as expected). However, if I add the two Spacers everything disappears.
ToolbarItem(placement: .bottomBar) {
HStack {
Button(Constants.Buttons.Location) {
print("button")
}
//Spacer()
Image(systemName: Constants.Icons.Share)
//Spacer()
Button(Constants.Buttons.Website) {
print("button")
}
}
}
If I add them all individually (including the two Spacers) I get the result I was expecting.
ToolbarItem(placement: .bottomBar) {
Button(Constants.Buttons.Location) {
print("button")
}
}
ToolbarItem(placement: .bottomBar) {
Spacer()
}
ToolbarItem(placement: .bottomBar) {
Image(systemName: Constants.Icons.Share)
}
ToolbarItem(placement: .bottomBar) {
Spacer()
}
ToolbarItem(placement: .bottomBar) {
Button(Constants.Buttons.Website) {
print("button")
}
}
ToolbarItem(placement: .bottomBar) {
HStack {
Button(Constants.Buttons.Location) {
print("button")
}
//Spacer()
Image(systemName: Constants.Icons.Share)
//Spacer()
Button(Constants.Buttons.Website) {
print("button")
}
}
}
If I add them all individually (including the two Spacers) I get the result I was expecting.
ToolbarItem(placement: .bottomBar) {
Button(Constants.Buttons.Location) {
print("button")
}
}
ToolbarItem(placement: .bottomBar) {
Spacer()
}
ToolbarItem(placement: .bottomBar) {
Image(systemName: Constants.Icons.Share)
}
ToolbarItem(placement: .bottomBar) {
Spacer()
}
ToolbarItem(placement: .bottomBar) {
Button(Constants.Buttons.Website) {
print("button")
}
}