HStack
The HStack
view is a layout container where elements, or subviews, are arranged in a horizontal line (left-to-right).
Syntax
var body: some View {
HStack {
Subviews here
}
}
The HStack
view rests within the body of a View
.
Example
In the example below, two Text
subviews are nested in the HStack
:
var body: some View {HStack {Text("Subview 1")Text("Subview 2")}}
This will display the following: