Welcome to the forum.
You place both buttons as topBarLeading. Is it on purpose ? No issue if this second button is topBarTrailing
The same occurs if MyButtonStyle is first: it gets clipped.
Idem if MyButtonStyle is the only button:
And if image is removed, Text is truncated with ellipsis…
But setting a frame width for the text (or even better, the HStack) solves the problem:
struct MyButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
HStack {
Image(systemName: "chevron.backward")
Text("Back")
.frame(width: 80) // <<-- ADDED
}
}
}
So looks like that without setting the frame, frame is considered zero (or very small), probably to optimise space ?
You could file a bug report.
Topic:
UI Frameworks
SubTopic:
SwiftUI