title: SwiftUI: how to make a view fit into a certain size
body: <p>So basically I have this view in my app.
  <a href="https://i.stack.imgur.com/n9YYs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/n9YYs.png" alt="enter image description here" /></a></p>
  <p>I want the box named LaMarcus Aldridge be the same size as the rest Basically I want to reduce the size of the box by reducing the amount of space between the picture and lines of text so that all boxes are the same size. I originally thought about going about it mathematically by calculating the space needed, but I am pretty sure that there is better way to do this that I am just no thinking of. Thank you I really appreciate it.</p>
  <p>Here is the code that declared those boxes.</p>
  <pre><code>var body: some View {
          VStack(spacing: 15) { //first
              Image(uiImage: question.players[0].picture)
                  .resizable()
                  .aspectRatio(contentMode: .fit)
                  .frame(height: 140)
  //                .padding(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
              
              Text(question.players[0].name)
                  .font(.title2)
                  .fontWeight(.heavy)
                  .foregroundColor(.black)
                  .multilineTextAlignment(.center)
                  .lineLimit(2)
              
              Text(question.players[0].team)
                  .foregroundColor(.black)
                  .multilineTextAlignment(.center)
          }
          .padding()
          .frame(maxWidth: .infinity)
          .onTapGesture(perform: {
              selectedAnswer = question.players[0]
          })
          
          .background(
              RoundedRectangle(cornerRadius: 15)
                  .stroke(color(option: question.players[0]), lineWidth: 5)
          )
          .cornerRadius(15)
          
          VStack(spacing: 15) { //second
              Image(uiImage: question.players[1].picture)
                  .resizable()
                  .aspectRatio(contentMode: .fit)
                  .frame(height: 140)
              Text(question.players[1].name)
                  .font(.title2)
                  .fontWeight(.heavy)
                  .foregroundColor(.black)
                  .multilineTextAlignment(.center)
                  .lineLimit(2)
              
              Text(question.players[1].team)
                  .foregroundColor(.black)
                  .multilineTextAlignment(.center)
          }
          
          .padding()
          .frame(maxWidth: .infinity)
          .onTapGesture(perform: {
              selectedAnswer = question.players[1]
          })
          .background(
              RoundedRectangle(cornerRadius: 15)
                  .stroke(color(option: question.players[1]), lineWidth: 5)
          )
          .cornerRadius(15)
          
          VStack(spacing: 15) { //third
              Image(uiImage: question.players[2].picture)
                  .resizable()
                  .aspectRatio(contentMode: .fit)
                  .frame(height: 140)
              Text(question.players[2].name)
                  .font(.title2)
                  .fontWeight(.heavy)
                  .foregroundColor(.black)
                  .multilineTextAlignment(.center)
                  .lineLimit(2)
              
              Text(question.players[2].team)
                  .foregroundColor(.black)
                  .multilineTextAlignment(.center)
          }
          
          .padding()
          .frame(maxWidth: .infinity)
          .onTapGesture(perform: {
              selectedAnswer = question.players[2]
          })
          .background(
              RoundedRectangle(cornerRadius: 15)
                  .stroke(color(option: question.players[2]), lineWidth: 5)
          )
          .cornerRadius(15)
          
          VStack(spacing: 15) { //fourth
              Image(uiImage: question.players[3].picture)
                  .resizable()
                  .aspectRatio(contentMode: .fit)
                  .frame(height: 140)
              Text(question.players[3].name)
                  .font(.title2)
                  .fontWeight(.heavy)
                  .foregroundColor(.black)
                  .multilineTextAlignment(.center)
                  .lineLimit(2)
              
              Text(question.players[3].team)
                  .foregroundColor(.black)
                  .multilineTextAlignment(.center)
          }
          
          .padding()
          .frame(maxWidth: .infinity)
          .onTapGesture(perform: {
              selectedAnswer = question.players[3]
          })
          .background(
              RoundedRectangle(cornerRadius: 15)
                  .stroke(color(option: question.players[3]), lineWidth: 5)
          )
          .cornerRadius(15)
      }
  </code></pre>