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

# init(alignment:spacing:content:)

Creates an instance with the given spacing and horizontal alignment.

## Declaration

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

## Parameters

- `alignment`: The guide for aligning the subviews in this stack. This guide has the same vertical screen coordinate for every subview.
- `spacing`: The distance between adjacent subviews, or nil if you want the stack to choose a default distance for each pair of subviews.
- `content`: A content builder that creates the content of this stack.
