AEPStack
The AEPStack class is a fundamental layout container used to arrange multiple UI elements horizontally or vertically.
AEPStack conforms to ObservableObject
, allowing it to be used reactively in SwiftUI views.
Public Properties
Property | Type | Description | Default Value |
---|---|---|---|
spacing | CGFloat | The spacing between child views in the stack. | 8 |
modifier | AEPViewModifier | A custom view modifier for additional styling. | N/A |
All properties are marked with @Published. Any changes will trigger updates to your UI.
AEPHStack
The AEPHStack class extends AEPStack and arranges its child views horizontally. It provides additional customization for aligning child views vertically.
Public Properties
Property | Type | Description | Default Value |
---|---|---|---|
alignment | The vertical alignment of child views in the stack. |
AEPVStack
The AEPVStack class extends AEPStack and arranges its child views vertically. It provides additional customization for aligning child views horizontally.
Public Properties
Property | Type | Description | Default Value |
---|---|---|---|
alignment | The horizontal alignment of child views in the stack. |
Customization
Below is an example of how to customize the AEPHStack and AEPVStack properties when working with a SmallImageTemplate
:
Swift
Copied to your clipboardclass MyCustomizer : ContentCardCustomizing {func customize(template: SmallImageTemplate) {// customize stack propertiestemplate.rootHStack.spacing = 10template.textVStack.alignment = .leadingtemplate.textVStack.spacing = 20// Customize the button stacktemplate.buttonHStack.modifier = AEPViewModifier(ButtonHStackModifier())}struct ButtonStackModifier: ViewModifier {func body(content: Content) -> some View {content.frame(maxWidth: .infinity, alignment: .trailing)}}}