depthAlignment(_:content:)
Creates a layout view with the specified depth alignment.
Declaration
nonisolated func depthAlignment<Content>(_ alignment: DepthAlignment, @ViewBuilder content: () -> Content) -> some View where Content : View
Parameters
- alignment:
A Depthalignment value to use for aligning layout’s subviews
Discussion
Use depthAlignment(_:content:) 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.
HStackLayout().depthAlignment(.front) {
RobotModel()
Button("Play animation") {
playRobotAnimation()
}
.glassBackgroundEffect()
}