title: SwiftUI HStack with wrap and dynamic height
body: <p>I have this view to show text tags on multiple lines which I got from <a href="https://stackoverflow.com/questions/58842453/swiftui-hstack-with-wrap?rq=1">SwiftUI HStack with Wrap</a>, but when I add it in a VStack the tags overlap any other view that I put below. 
  The tags are shown properly but the height of the view itself is not calculated inside the VStack.
  How can I make this view use the height of is content?</p>
  
  <pre><code>import SwiftUI
  
  struct TestWrappedLayout: View {
      @State var platforms = ["Ninetendo", "XBox", "PlayStation", "PlayStation 2", "PlayStation 3", "PlayStation 4"]
  
      var body: some View {
          GeometryReader { geometry in
              self.generateContent(in: geometry)
          }
      }
  
      private func generateContent(in g: GeometryProxy) -&gt; some View {
          var width = CGFloat.zero
          var height = CGFloat.zero
  
          return ZStack(alignment: .topLeading) {
              ForEach(self.platforms, id: \.self) { platform in
                  self.item(for: platform)
                      .padding([.horizontal, .vertical], 4)
                      .alignmentGuide(.leading, computeValue: { d in
                          if (abs(width - d.width) &gt; g.size.width)
                          {
                              width = 0
                              height -= d.height
                          }
                          let result = width
                          if platform == self.platforms.last! {
                              width = 0 //last item
                          } else {
                              width -= d.width
                          }
                          return result
                      })
                      .alignmentGuide(.top, computeValue: {d in
                          let result = height
                          if platform == self.platforms.last! {
                              height = 0 // last item
                          }
                          return result
                      })
              }
          }
      }
  
      func item(for text: String) -&gt; some View {
          Text(text)
              .padding(.all, 5)
              .font(.body)
              .background(Color.blue)
              .foregroundColor(Color.white)
              .cornerRadius(5)
      }
  }
  
  struct TestWrappedLayout_Previews: PreviewProvider {
      static var previews: some View {
          TestWrappedLayout()
      }
  }
  </code></pre>
  
  <p>Example code:</p>
  
  <pre><code>struct ExampleTagsView: View {
      var body: some View {
          ScrollView {
              VStack(alignment: .leading) {
                  Text("Platforms:")
                  TestWrappedLayout()
  
                  Text("Other Platforms:")
                  TestWrappedLayout()
              }
          }
      }
  }
  
  struct ExampleTagsView_Previews: PreviewProvider {
      static var previews: some View {
          ExampleTagsView()
      }
  }
  </code></pre>
  
  <p>Result:
  <a href="https://i.stack.imgur.com/HHlD1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HHlD1.png" alt="enter image description here"></a></p>