Edit in GitHubLog an issue

AEPText

The AEPText class is a fundamental UI component used to display text for content cards.

This class allows you to customize the text element with properties like font, color, and modifier.

AEPText class conforms to ObservableObject, allowing it to be used reactively in SwiftUI views.

Properties

PropertyTypeDescriptionDefault Value
content
String
The actual text content to be displayed.
N/A
font
The font to be used for the text.
Depends on the type of text:
  • Title:
    System font
    Size 15
    Medium weight
  • Body :
    System font
    Size 13
    Regular weight
  • ButtonText :
    System font
    Size 13
    Regular weight
color
The color of the text.
Depends on the type of text:
modifier
AEPViewModifier
A custom view modifer that can be applied to the text view for additional styling
N/A

Customization

Below is an example of how to customize the AEPText properties when working with a SmallImageTemplate:

Copied to your clipboard
class MyCustomizer : ContentCardCustomizing {
func customize(template: SmallImageTemplate) {
// Customize the title text element
template.title.font = .subheadline
template.title.textColor = .green
template.title.modifier = AEPViewModifier(MyTitleModifier())
// Customize the body text element, if available
template.body?.font = .caption
}
struct MyTitleModifier: ViewModifier {
func body(content: Content) -> some View {
content
.padding()
.background(Color.yellow)
.cornerRadius(5)
}
}
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.