frame(depth:alignment:)
Positions this view within an invisible frame with the specified depth.
Declaration
nonisolated func frame(depth: CGFloat?, alignment: DepthAlignment = .center) -> some View
Parameters
- depth:
A fixed depth for the resulting view. If
depthisnil, the resulting view assumes this view’s sizing behavior. - alignment:
The alignment of this view inside the resulting view.
alignmentapplies if this view is smaller than the size given by the resulting frame.
Return Value
A view with a fixed dimension of depth if non-nil.
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:)frame(minWidth:idealWidth:maxWidth:minHeight:idealHeight:maxHeight:alignment:)frame(minDepth:idealDepth:maxDepth:alignment:)containerRelativeFrame(_:alignment:)containerRelativeFrame(_:alignment:_:)containerRelativeFrame(_:count:span:spacing:alignment:)fixedSize()fixedSize(horizontal:vertical:)layoutPriority(_:)