21.1 SwiftUI Stacks
SwiftUI includes three stack layout views in the form of VStack (vertical), HStack (horizontal) and ZStack (views are layered on top of each other).
A stack is declared by embedding child views into a stack view within the SwiftUI View file. In the following view, for example, three Image views have been embedded within an HStack:
struct ContentView: View {
var body: some View {
HStack {
Image(systemName: "goforward.10")
Image(systemName: "goforward.15")
Image(systemName: "goforward.30")
}
}
}
Within the preview canvas, the above layout will appear as illustrated in Figure 21-1:
...