ContentCardUIEventListening

A protocol that defines methods for listening to UI events related to content cards.

Protocol Definition

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

Swift

public protocol ContentCardUIEventListening {
    func onDisplay(_ card: ContentCardUI)
    func onDismiss(_ card: ContentCardUI)
    func onInteract(_ card: ContentCardUI, _ interactionId: String, actionURL: URL?) -> Bool
}

Methods

onDisplay

Called when the content card appears on the screen. Implementation of this method is optional.

Parameters

Syntax

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

Swift

func onDisplay(_ card: ContentCardUI)

onDismiss

Called when the content card is dismissed. Implementation of this method is optional.

Parameters

Syntax

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

Swift

func onDismiss(_ card: ContentCardUI)

onInteract

Called when the user interacts with the content card. Implementation of this method is optional.

Parameters

Returns

A boolean value indicating whether the interaction event was handled. Return true if the client app has handled the actionURL associated with the interaction. Return false if the SDK should handle the actionURL.

Syntax

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

Swift

func onInteract(_ card: ContentCardUI, _ interactionId: String, actionURL: URL?) -> Bool