VStack
Christine_Yang271 total contributions
Published Oct 10, 2022
Contribute to Docs
The VStack
view is a layout container where elements, or subviews, are arranged in a vertical line (top-to-bottom).
Syntax
var body: some View {
VStack {
Subviews here
}
}
The VStack
view rests within the body of a View
.
Example
In the example below, two Text
subviews are nested in the VStack
:
var body: some View {VStack {Text("Subview 1")Text("Subview 2")}}
This will display the following:
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.