<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ZStackLayout",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI12ZStackLayoutV"
  },
  "title" : "ZStackLayout"
}
-->

# ZStackLayout

An overlaying container that you can use in conditional layouts.

```
@frozen struct ZStackLayout
```

## Overview

This layout container behaves like a [`ZStack`](/documentation/SwiftUI/ZStack), but conforms to the
[`Layout`](/documentation/SwiftUI/Layout) protocol so you can use it in the conditional layouts that you
construct with [`AnyLayout`](/documentation/SwiftUI/AnyLayout). If you don’t need a conditional layout, use
[`ZStack`](/documentation/SwiftUI/ZStack) instead.

## Topics

### Creating a stack

[`init(alignment:)`](/documentation/SwiftUI/ZStackLayout/init(alignment:))

Creates a stack with the specified alignment.

### Getting the stack’s properties

[`alignment`](/documentation/SwiftUI/ZStackLayout/alignment)

The alignment of subviews.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)