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

# init(alignment:content:)

Creates an instance with the given alignment.

## Declaration

```swift
nonisolated init(alignment: Alignment = .center, @ContentBuilder content: () -> Content)
```

## Parameters

- `alignment`: The guide for aligning the subviews in this stack on both the x- and y-axes.
- `content`: A content builder that creates the content of this stack.
