depthAlignment(_:)
Sets the depth alignment for this layout.
Declaration
func depthAlignment(_ alignment: DepthAlignment) -> some Layout
Parameters
- alignment:
A Depthalignment value to use for aligning layout’s subviews
Discussion
Use depthAlignment(_:) to specify a depth guide for aligning subviews of this layout.
In the example below, the button to play the robot animation is aligned to the .front of the HStack.
let depthStack = HStackLayout().depthAlignment(.front)
depthStack {
RobotModel()
Button("Play animation") {
playRobotAnimation()
}
.glassBackgroundEffect()
}