Edit in GitHubLog an issue

InboxEventListening

A protocol that defines methods for listening to state changes and content card interaction events from an InboxUI instance.

Protocol Definition

Copied to your clipboard
public protocol InboxEventListening {
func onLoading(_ inbox: InboxUI)
func onSuccess(_ inbox: InboxUI)
func onError(_ inbox: InboxUI, _ error: Error)
func onCardCreated(_ card: ContentCardUI)
func onCardDisplayed(_ card: ContentCardUI)
func onCardDismissed(_ card: ContentCardUI)
func onCardInteracted(_ card: ContentCardUI, _ interactionId: String, actionURL: URL?) -> Bool
}

All methods have default no-op implementations, so you only need to implement the methods relevant to your use case.

Inbox State Methods

onLoading

Called when the inbox begins loading content. Triggered when the InboxUI is first created or when a refresh (pull-to-refresh or programmatic) begins.

Parameters

  • inbox - The InboxUI that is loading.

Syntax

Copied to your clipboard
func onLoading(_ inbox: InboxUI)

onSuccess

Called when the inbox successfully loads content. Triggered whether the inbox contains cards or is empty.

Parameters

  • inbox - The InboxUI that loaded successfully.

Syntax

Copied to your clipboard
func onSuccess(_ inbox: InboxUI)

onError

Called when the inbox encounters an error while loading. See InboxError for the error types that can be returned.

Parameters

  • inbox - The InboxUI that encountered an error.
  • error - The error describing what went wrong.

Syntax

Copied to your clipboard
func onError(_ inbox: InboxUI, _ error: Error)

Content Card Methods

onCardCreated

Called when a content card is created and configured. This is called once per card when the inbox loads or refreshes.

Parameters

Syntax

Copied to your clipboard
func onCardCreated(_ card: ContentCardUI)

onCardDisplayed

Called when a content card appears on screen. Use this to track card impressions.

Parameters

Syntax

Copied to your clipboard
func onCardDisplayed(_ card: ContentCardUI)

onCardDismissed

Called when a user dismisses a content card. The inbox automatically removes the dismissed card from the UI.

Parameters

Syntax

Copied to your clipboard
func onCardDismissed(_ card: ContentCardUI)

onCardInteracted

Called when the user interacts with a content card (e.g., taps a button or link). The return value controls whether the SDK handles the actionURL.

Parameters

  • card - The ContentCardUI that was interacted with.
  • interactionId - A string identifier for the interaction (e.g., a button ID).
  • actionURL - The optional URL associated with the interaction.

Returns

Return true if your application handled the actionURL. Return false to let the SDK handle it.

Syntax

Copied to your clipboard
func onCardInteracted(_ card: ContentCardUI, _ interactionId: String, actionURL: URL?) -> Bool

Example

Copied to your clipboard
func onCardInteracted(_ card: ContentCardUI, _ interactionId: String, actionURL: URL?) -> Bool {
guard let url = actionURL else { return false }
if url.scheme == "myapp" {
handleDeepLink(url)
return true // app handled it
}
return false // let SDK open the URL
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2026 Adobe. All rights reserved.