layout/DSStack
DSStack
layoutConvenience wrapper around HStack/VStack with design-token spacing pre-applied.
iOS 17+macOS 14+watchOS 10+visionOS 1+
Purpose
Replace ad-hoc HStack/VStack with consistent spacing from the token system.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| axis | Axis | .vertical | Stack direction. |
| spacing | CGFloat | DSSpacing.md | Gap between children. |
| alignment | HorizontalAlignment | .leading | Cross-axis alignment. |
| contentreq | ViewBuilder | โ | Stack children. |
Examples
Form layout
Vertical stack with token spacing.
swift
DSStack(spacing: DSSpacing.lg) {
DSTextField(label: "Name", text: $name)
DSTextField(label: "Email", text: $email)
DSButton("Continue", variant: .primary, action: next)
}