title: SwiftUI - Vertical Centering Content inside Scrollview
body: <p>i'm trying to code a simple login page on my app. I started using SwiftUI on my newlly updated Mac OS Catalina. The Apple documentation is still lacking a lot. 
  I need to center a VStack vertically on a Scrollview ocupying the whole page with a "limit" on it's width of 400.</p>
  
  <p>Something like this:</p>
  
  <pre><code>ScrollView(.vertical) {
      VStack {
          Text("Hello World")
      }
      .frame(maxWidth: 400, alignment: .center)
  }
  </code></pre>
  
  <p>It was easy with UIScrollView, just needed to set the ContentView to fill height and width and then centering a Vertical StackLayout inside the Content View but now with SwiftUI i just wonder..</p>
  
  <p>The goal is something like this (Credit to the author)</p>
  
  <p><a href="https://i.stack.imgur.com/RpjJZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RpjJZ.png" alt="enter image description here"></a></p>
  
  <p>If someone is wondering why i want everything inside a scrollview, it's beacause my form is quite big and i expect the user to use both landscape and portrait view so i really need the content to be scrollable, bear in mind also that in a Ipad the form doens't fill the whole screen that's why i want it centered vertically.</p>