AEPDismissButton
The AEPDismissButton class is a fundamental UI component used to create a dismiss button for content cards.
Customization of the dismiss button's properties can be achieved with a custom view modifier.
AEPDismissButton conforms to ObservableObject
, allowing it to be used reactively in SwiftUI views.
Public Properties
Property | Type | Description |
---|---|---|
image | The image model representing the dismiss button's image. | |
alignment | The alignment of the dismiss button within the content card. | |
modifier | AEPViewModifier | A custom view modifier that can be applied to the dismiss button view for additional styling. |
All properties are marked with @Published. Any changes will trigger updates to the UI.
Customization
You can customize the AEPDismissButton properties when working with a template that includes a dismiss button. Here's an example:
Swift
Copied to your clipboardclass MyCustomizer: ContentCardCustomizing {func customize(template: SmallImageTemplate) {// Customize the dismiss buttontemplate.dismissButton?.image.icon = "xmark.diamond" // SF Symbol nametemplate.dismissButton?.image.iconColor = .primarytemplate.dismissButton?.image.iconFont = .system(size: 10)template.dismissButton?.alignment = .topTrailingtemplate.dismissButton?.modifier = AEPViewModifier(MyDismissButtonModifier())}struct MyDismissButtonModifier: ViewModifier {func body(content: Content) -> some View {content.padding()}}}