SwiftUI Equal and Ideal Sizes
Matthias Maurberger (via SwiftUI Weekly):
One example that illustrates this quite well is when you want to make all children of a
VStackas wide as the widest child. Sounds like it should be straightforward. But it’s not. It’s a surprisingly hard problem.[…]
First, we’ll wrap each Button’s
Textlabel in a.framemodifier withmaxWidth: .infnity. That alone only solves our problem if we want our stack of buttons to occupy the full width it was given. If we want the stack of buttons to be as wide as it needs to be, we’ll need to make a second adjustment: apply thefixedSizemodifier to theVStack.
Previously: