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

# init(alignment:spacing:)

Creates a vertical stack with the specified spacing and horizontal alignment.

## Declaration

```swift
init(alignment: HorizontalAlignment = .center, spacing: CGFloat? = nil)
```

## Parameters

- `alignment`: The guide for aligning the subviews in this stack. It has the same horizontal screen coordinate for all subviews.
- `spacing`: The distance between adjacent subviews. Set this value to nil to use default distances between subviews.
