VStack
A view that arranges its subviews in a vertical line.
Declaration
@frozen struct VStack<Content> where Content : ViewMentioned in
Overview
Unlike LazyVStack, which only renders the views when your app needs to display them, a VStack renders the views all at once, regardless of whether they are on- or offscreen. Use the regular VStack when you have a small number of subviews or don’t want the delayed rendering behavior of the “lazy” version.
The following example shows a simple vertical stack of 10 text views:
var body: some View {
VStack(
alignment: .leading,
spacing: 10
) {
ForEach(
1...10,
id: \.self
) {
Text("Item \($0)")
}
}
}[Image]