0

I'm trying to make the text in the VStack the same width but don't know how. I saw it suggested elsewhere to set a frame maxWidth to .infinity for each of the Text Views but it doesn't have any effect when I try it in my code.

This is the code I have:

struct ContentView: View {
    var body: some View {
        VStack(alignment: .center, spacing: 8.0) {
            Spacer()
            Text("Youngsters can play in Kids mode. If you're feeling very adventurous you can play in BigKids mode.")
                .padding(.horizontal)
            Text("Kids mode uses large images and big differences between the number of images shown.")
                .padding(.horizontal)
            Text("BigKids mode, on the other hand, uses small images and small differences between the number of images shown. Go for it!")
                .padding(.horizontal)
            Spacer()
        }
        .frame(maxWidth: 600.0)
    }
}

I'm using a frame maxWidth of 600 for the VStack as I don't want it wider than that when an iPad is used.

Here's the results of the code. Note that each Text View is a different width.

Results of the code

0 Answers0