One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

HStack

struct · iOS 13.0+ · SDK 27.1

@frozen nonisolated struct HStack<Content> where Content : View

A view that arranges its subviews in a horizontal line. 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)") } } } ![Five text views, named Item 1 through Item 5, arranged in a horizontal row.](SwiftUI-HStack-simple.png) > Note: If you need a horizontal stack that conforms to the ``Layout`` protocol, like when you want to create a conditional layout using ``AnyLayout``, use ``HStackLayout`` instead.

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

HStack.init(alignment:spacing:content:)

callback cannot propagate synchronous failure

All SwiftUICore types →