I'm adding some buttons to the navigationbar in SwiftUI and because I need to add some padding to them, they are displayed more to the left than I intend (as seen below).
I can fix this if I remove the individual padding from each button, but in that case the tap area is very limited and unusual from an UX perspective.
Is there a way to remove the default extra padding?
.navigationBarItems(
trailing:
HStack(alignment: .center, spacing: 0) {
Button(action: {
}) {
Image(systemName: "trash")
.imageScale(.large)
.accessibility(label: Text("Delete"))
.padding()
}
Button(action: {
}) {
Image(systemName: "square.and.arrow.up")
.imageScale(.large)
.accessibility(label: Text("Share"))
.padding()
}
CustomEditButton() {
if self.mode?.wrappedValue == .active {
return self.triggerSave()
} else {
return true
}
}
}
)



