Modifiers
alignmentGuide
Sets the position of a horizontal alignment guide of this view.
alignmentGuide(guide, value)
| Parameter | Type | Description |
|---|---|---|
guide | 'center' | 'leading' | 'trailing' | 'listRowSeparatorLeading' | 'listRowSeparatorTrailing' | The horizontal alignment guide to set. 'listRowSeparatorLeading' and 'listRowSeparatorTrailing' do nothing on tvOS, where SwiftUI does not provide them. |
value | number | The position of the guide, in points from the leading edge of the view. |
Sets the position of a horizontal alignment guide of this view.
Use the 'listRowSeparatorLeading' guide to set where the separator of a List row starts. SwiftUI insets a row separator past a leading Image, but not past other leading content, so rows with different leading content get separators that start at different offsets.
Returns: ModifierConfig
See: Official SwiftUI documentation.
Example
<HStack modifiers={[alignmentGuide('listRowSeparatorLeading', 32)]}>
<Text>A</Text>
<Text>The separator starts 32 points from the leading edge</Text>
</HStack>Works with
This modifier works with any view. These components accept it:
- VStack
- HStack
- ZStack
- LazyVStack
- LazyHStack
- Group
- Spacer
- Divider
- Overlay
- ScrollView
- Button
- Toggle
- Checkbox
- Slider
- Picker
- DatePicker
- ColorPicker
- Link
- ControlGroup
- Menu
- ContextMenu
- TextField
- SecureField
- Text
- Label
- Image
- List
- Form
- Section
- DisclosureGroup
- SwipeActions
- BottomSheet
- Alert
- ConfirmationDialog
- Popover
- ProgressView
- Gauge
- TabView
- AccessoryWidgetBackground
Sources
The original Expo docs for this page:
- alignmentGuide (Modifiers) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)