InboxState
An enum representing the current state of an InboxUI instance.
Enum Definition
Copied to your clipboardpublic enum InboxState {case loadingcase loaded([ContentCardUI])case error(Error)}
Cases
| Case | Associated Value | Description |
|---|---|---|
loading | — | The inbox is fetching content. The default loading view (or custom loading view) is displayed. |
loaded | [ContentCardUI] | Content has been fetched. The associated array contains the content cards to display. The array may be empty if the inbox has no content, in which case the empty state view is displayed. |
error | Error | An error occurred while loading. The associated value is the Error that was encountered. See InboxError for inbox-specific error types. |
Usage
InboxState is exposed as a @Published property on InboxUI. You can observe it directly if you need to drive custom UI outside of the built-in InboxUI.view.
Swift
Copied to your clipboardimport SwiftUIimport AEPMessagingstruct InboxPage: View {@ObservedObject var inboxUI: InboxUIvar body: some View {switch inboxUI.state {case .loading:ProgressView("Loading...")case .loaded(let cards) where cards.isEmpty:Text("No messages")case .loaded(let cards):ScrollView {ForEach(cards) { card incard.view}}case .error(let error):Text("Error: \(error.localizedDescription)")}}}
When using InboxUI.view, state transitions are handled automatically. Use InboxState directly only when you need to build fully custom rendering outside of the provided view.
