HStack
A view that arranges its subviews in a horizontal line.
Declaration
@frozen struct HStack<Content> where Content : ViewMentioned in
Overview
Unlike LazyHStack, which only renders the views when your app needs to display them onscreen, an HStack renders the views all at once, regardless of whether they are on- or offscreen. Use the regular HStack 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 horizontal stack of five text views:
var body: some View {
HStack(
alignment: .top,
spacing: 10
) {
ForEach(
1...5,
id: \.self
) {
Text("Item \($0)")
}
}
}[Image]