EmptyStateSettings

Settings that define how an empty inbox looks when there are no content cards to display.

Struct Definition

public struct EmptyStateSettings: Codable

Public Properties

Property
Type
Description
message
AEPText?
Optional text message to display in the empty state. Configured in Adobe Journey Optimizer.
image
AEPImage?
Optional image to display in the empty state. Configured in Adobe Journey Optimizer.

Usage

EmptyStateSettings is passed to the custom empty view builder set via InboxUI.setEmptyView(_:). Use configured values when available and fall back to your own defaults otherwise.

data-slots=heading, code
data-repeat=1
data-languages=Swift

Swift

inboxUI.setEmptyView { emptyStateSettings in
    AnyView(
        VStack(spacing: 16) {
            if let image = emptyStateSettings?.image {
                image.view
                    .frame(maxWidth: 120, maxHeight: 120)
            } else {
                Image(systemName: "tray")
                    .font(.system(size: 60))
                    .foregroundColor(.gray)
            }

            if let message = emptyStateSettings?.message {
                message.view
                    .multilineTextAlignment(.center)
            } else {
                Text("No messages")
                    .font(.headline)
                    .foregroundColor(.secondary)
            }
        }
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .padding()
    )
}