title: Dynamically add elements to VStack in SwiftUI
body: <p>(Swift 5, SwiftUI)
  If I have the following code for a VStack:</p>
  
  <pre><code>struct ContentView: View {
  
  var body: some View {
  
      ScrollView {
          VStack(alignment: .leading) {
  
                  //Inside of VStack
  
          }.padding()
          .padding(.bottom, keyboard.currentHeight)
          .edgesIgnoringSafeArea(.bottom)
          .animation(.easeOut(duration: 0.16))
      }
  }
  }
  </code></pre>
  
  <p>How can I dynamically add Text()s to the VStack through a function and update the ScrollView height accordingly?</p>
  
  <p>The function (is called by a button press):</p>
  
  <pre><code>func add() -&gt; Void {
      //Adds a Text() element to the VStack. The content of the Text() is received from an API 
      //call, so it can't be hardcoded.
  }
  </code></pre>
  
  <p>I'm looking for a simple way to add Text() elements to my VStack. I've extensively searched for the problem on Google but found nothing similar to this trivial problem. Any help would be appreciated.</p>