I can accomplish a full-width button with the following code:
Button {
print("Test, 123 ...")
}
label: {
Text("Trigger Action")
.frame(maxWidth: .infinity)
.frame(height: 50)
.background(Color.blue)
.foregroundStyle(Color.white)
.cornerRadius(12)
}
It works fine.
But why “maxWidth: .infinity”?
Why isn’t it “minWidth: .infinity”? That would make more sense to me.
Can someone explain, how the .frame-modifier works internally? And why it works the way it does