---
title: "init(alignment:spacing:pinnedViews:content:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/lazyhstack/init(alignment:spacing:pinnedviews:content:)"
---

# init(alignment:spacing:pinnedViews:content:)

Creates a lazy horizontal stack view with the given spacing, vertical alignment, pinning behavior, and content.

## Declaration

```swift
nonisolated init(alignment: VerticalAlignment = .center, spacing: CGFloat? = nil, pinnedViews: PinnedScrollableViews = .init(), @ContentBuilder content: () -> Content)
```

## Parameters

- `alignment`: The guide for aligning the subviews in this stack. All child views have the same vertical screen coordinate.
- `spacing`: The distance between adjacent subviews, or nil if you want the stack to choose a default distance for each pair of subviews.
- `pinnedViews`: The kinds of child views that will be pinned.
- `content`: A content builder that creates the content of this stack.
