title: Aligning HStack without equal sizing in SwiftUI
body: <p>I have a custom chart with some texts as seen below. It aligns <strong>the first text correctly</strong>, it aligns <strong>the last text incorrectly</strong>. I need the VStack with the texts to stretch like an accordion so that the last text's centerY aligns with the bottom of the chart.</p>
  
  <p>As seen with the blue Xcode highlight, the VStack receives the same size as the chart with an offset.</p>
  
  <p><a href="https://i.stack.imgur.com/GRpaZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GRpaZ.png" alt="chart image"></a></p>
  
  <p>To align the first text, I extended VerticalAlignment as seen in <a href="https://developer.apple.com/videos/play/wwdc2019/237/" rel="nofollow noreferrer">WWDC 2019 - Session 237</a>.</p>
  
  <pre><code>extension VerticalAlignment {
     private enum TopChartAndMidTitle: AlignmentID {
        static func defaultValue(in dimensions: ViewDimensions) -&gt; Length {
           return dimensions[.top]
        }
     }
     static let topChartAndMidTitle = VerticalAlignment(TopChartAndMidTitle.self)
  }
  </code></pre>
  
  <p>Then I used it like this:</p>
  
  <pre><code>var labels = ["1900", "1800", "1700", "1600", "1500", "1400"]
  
  var body: some View {
      HStack(alignment: .topChartAndMidTitle) {
          chart()
              .alignmentGuide(.topChartAndMidTitle) { $0[.top] }
          valueLabels()
      }
  }
  
  private func valueLabels() -&gt; AnyView {
      AnyView(VStack {
          Text(labels[0]).font(.footnote)
              .alignmentGuide(.topChartAndMidTitle) { $0[.bottom] / 2 }
          ForEach(labels.dropFirst().identified(by: \.self)) { label in
              Spacer()
              Text(label).font(.footnote)
          }
      })
  }
  </code></pre>
  
  <p><strong>Question:</strong> How do I align the last text against the chart bottom and thereby stretch the VStack?</p>
  
  <p>To test this, just replace my custom chart with <code>Rectangle().fill(Color.red)</code>. It will result in the same problem.</p>