title: SwiftUI Align HStack with different size elements
body: <p>I am looking to build an HStack that has 3 elements in it, one to the left, one in the middle and one to the right. The middle element should always be in the centre, but because the left and right elements are dynamic and so can be different lengths the middle element is getting pushed depending on the size of the side elements (see picture below). I am using spacers and padding, but need something that will auto adjust the size of the spacers. Does anyone know of a way to do this?</p>
  <p>See code attached below:</p>
  <pre class="lang-swift prettyprint-override"><code>VStack(alignment: .leading){
                      Text(item.itemName)
                          .padding(1)
                          .padding(.horizontal, 20)
                      
                      HStack{
                          //Representative item code
                          Text(&quot;123454&quot;)
                              .padding(.horizontal, 20)
                          Spacer()
                          
                          Text(item.itemQuantity)
                              //.position(x: 100)
  
                          Spacer()
                          Text(item.itemPrice)
                              .padding(.horizontal, 20)
                      }
  
                  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/mOi0v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mOi0v.png" alt="Image showing unaligned hstack items" /></a></p>