I am trying to create 2 buttons that are equal width, positioned one above the other, vertically. It should look like this:
I have placed 2 Buttons inside a VStack which automatically expands to the width of the larger button. What I am trying to do is have the width of the buttons expand to fill the width of the VStack, but this is what I get instead:
VStack(alignment: .center, spacing: 20) { NavigationLink(destination: CustomView()) { Text("Button") }.frame(height: 44) .background(Color.primary) Button(action: { self.isShowingAlert = true }) { Text("Another Button") }.frame(height: 44) .background(Color.primary) }.background(Color.secondary) Setting the width of the VStack expands it, but the buttons do not expand to fit:
VStack(alignment: .center, spacing: 20) { ... }.frame(width: 320) .background(Color.secondary) So my question is:
Is there a way to do this, besides manually setting the frame of every item in my layout?
I would rather not have to specify each one as it will become difficult to manage.





