---
title: "frame(depth:alignment:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/frame(depth:alignment:)"
---

# frame(depth:alignment:)

Positions this view within an invisible frame with the specified depth.

## Declaration

```swift
nonisolated func frame(depth: CGFloat?, alignment: DepthAlignment = .center) -> some View

```

## Parameters

- `depth`: A fixed depth for the resulting view. If depth is nil, the resulting view assumes this view’s sizing behavior.
- `alignment`: The alignment of this view inside the resulting view. alignment applies if this view is smaller than the size given by the resulting frame.

## Return Value

Return Value A view with a fixed dimension of depth if non-nil.

## Discussion

Discussion Use this method to specify a fixed size for a view’s depth. If you don’t specify a dimension, the resulting view assumes this view’s sizing behavior in depth.

## See Also

### Influencing a view’s size

- [frame(width:height:alignment:)](swiftui/view/frame(width:height:alignment:).md)
- [frame(minWidth:idealWidth:maxWidth:minHeight:idealHeight:maxHeight:alignment:)](swiftui/view/frame(minwidth:idealwidth:maxwidth:minheight:idealheight:maxheight:alignment:).md)
- [frame(minDepth:idealDepth:maxDepth:alignment:)](swiftui/view/frame(mindepth:idealdepth:maxdepth:alignment:).md)
- [containerRelativeFrame(_:alignment:)](swiftui/view/containerrelativeframe(_:alignment:).md)
- [containerRelativeFrame(_:alignment:_:)](swiftui/view/containerrelativeframe(_:alignment:_:).md)
- [containerRelativeFrame(_:count:span:spacing:alignment:)](swiftui/view/containerrelativeframe(_:count:span:spacing:alignment:).md)
- [fixedSize()](swiftui/view/fixedsize().md)
- [fixedSize(horizontal:vertical:)](swiftui/view/fixedsize(horizontal:vertical:).md)
- [layoutPriority(_:)](swiftui/view/layoutpriority(_:).md)
