InAppMessagingFeature

@objc(SFInAppMessagingFeature)
public final class InAppMessagingFeature : NSObject, SFMCModule
extension InAppMessagingFeature: InAppMessagingFeatureApi
extension InAppMessagingFeature: Subscriber
extension InAppMessagingFeature: InAppMessagingFeatureProtocol

This class is a Swift Interface for SFInAppMessagingFeature

Request SDK Method

  • Requests the InAppMessaging Feature Module when it’s operational and safe to use. The provided callback will be invoked with the InAppMessaging Feature Module when it’s ready. All InAppMessaging feature module-related API calls should be made within this function.

    Declaration

    Swift

    @objc
    public static func requestSdk(_ callback: @escaping (_ inappMessagingFeature: InAppMessagingFeatureApi?) -> Void)

    Parameters

    callback

    A callback that will receive the InAppMessaging Feature Module when it’s operational/ready.

InAppMessaging Methods

  • Sets the delegate responsible for receiving in-app message display lifecycle and user interactions.

    Use this method to provide an InAppMessageEventDelegate implementation to observe events such as message display, dismissal, or user interaction. Passing nil removes the currently assigned delegate.

    Declaration

    Swift

    public func setEventDelegate(_ delegate: InAppMessageEventDelegate?)

    Parameters

    delegate

    An object conforming to InAppMessageEventDelegate, or nil to clear the existing delegate.

  • Displays a specific in-app message by its identifier.

    Use this method to manually trigger the presentation of an in-app message that corresponds to the provided messageId.

    Declaration

    Swift

    public func showInAppMessage(messageId: String)

    Parameters

    messageId

    The unique identifier of the in-app message to be displayed.

  • Sets the custom font used for rendering in-app messages.

    Use this method to configure a global font by name that will be applied to in-app message content. Passing nil resets the font to the default.

    Declaration

    Swift

    public func setInAppMessageFont(name: String?) -> Bool

    Parameters

    name

    The PostScript name of the font to use, or nil to revert to the default system font.

    Return Value

    true if the font was successfully set; otherwise false.

  • Sets the delegate responsible for handling URL interactions triggered by in-app messages.

    Use this method to provide a custom URLHandlingDelegate implementation to control how URLs (e.g., deep links or external links) are processed when a user interacts with an in-app message button action.

    Declaration

    Swift

    public func setURLHandlingDelegate(_ delegate: URLHandlingDelegate)

    Parameters

    delegate

    An object conforming to URLHandlingDelegate that will handle URL actions initiated from in-app messages.