MoEngageSDKCards

@objc
public class MoEngageSDKCards : NSObject, @unchecked Sendable

Class to configure Cards

  • Singleton instance

    Declaration

    Swift

    @objc
    public static var sharedInstance: MoEngageSDKCards { get }

Set Delegate

  • Set the Cards delegate

    Declaration

    Swift

    public func setCardsDelegate(
        delegate: MoEngageCardsDelegate,
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation
    )

    Parameters

    delegate

    delegate object

    appID

    MoEngage Account Identifier

  • Set the Cards delegate. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func setCardsDelegate(
        delegate: MoEngageCardsDelegate,
        forAppID appID: String? = nil
    )
  • Fetch Cards campaign for given category

    Declaration

    Swift

    @available(*, deprecated, message: "This API is deprecated. Please use the newer API getCardData(for:appID:completionBlock:﹚")
    public func getCards(
        forCategory category: String,
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletionBlock completionBlock:
            @escaping @MainActor(unsafe) (
                _ cards: [MoEngageCardCampaign],
                _ accountMeta: MoEngageAccountMeta?
            ) -> Void
    )

    Parameters

    category

    category for which cards should be fetched.

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with cards campaign info and account info.

  • Fetch Cards campaign for given category. Objective-C compatible overload.

    Declaration

    Swift

    @available(*, deprecated, message: "This API is deprecated. Please use the newer API getCardData(for:appID:completionBlock:﹚")
    @_disfavoredOverload
    @objc
    public func getCards(
        forCategory category: String,
        forAppID appID: String? = nil,
        withCompletionBlock completionBlock:
      @escaping @MainActor(unsafe) (
          _ cards: [MoEngageCardCampaign],
          _ accountMeta: MoEngageAccountMeta?
      ) -> Void
    )
  • Retrieves card information for a specified category

    Declaration

    Swift

    public func getCardData(
        for category: String,
        appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        completionBlock:
            @escaping @MainActor(unsafe) (MoEngageCardData?) -> Void
    )
  • Retrieves card information for a specified category. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func getCardData(
        for category: String,
        appID: String? = nil,
        completionBlock:
      @escaping @MainActor(unsafe) (MoEngageCardData?) -> Void
    )
  • Fetch ShowAllTab status.

    Declaration

    Swift

    public func isAllCategoryEnabled(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletionBlock completionBlock:
            @escaping @MainActor(unsafe) (Bool) -> Void
    )

    Parameters

    appID

    MoEngage Account Identifier

    Return Value

    true if All tab is shown else false

  • Fetch ShowAllTab status. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func isAllCategoryEnabled(
        forAppID appID: String? = nil,
        withCompletionBlock completionBlock:
      @escaping @MainActor(unsafe) (Bool) -> Void
    )

Fetch Cards

  • Fetch the latest cards after refreshing data with inbox sync interval.

    Declaration

    Swift

    public func fetchCards(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletion completionBlock: (
            @MainActor(unsafe) (_ data: MoEngageCardData?) -> Void
        )? = nil
    )

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with cards data and account info

  • Fetch the latest cards after refreshing data with inbox sync interval. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func fetchCards(
        forAppID appID: String? = nil,
        withCompletion completionBlock: (
      @MainActor(unsafe) (_ data: MoEngageCardData?) -> Void
        )? = nil
    )

Card Status

  • Fetch Cards status

    Declaration

    Swift

    public func getAllCardStatusDict(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletionBlock completionBlock:
            @escaping @MainActor(unsafe) ([[String: Any]]) -> Void
    )

    Parameters

    appID

    MoEngage Account Identifier

    Return Value

    Array of dictionary containing card status

Cards Data

  • Method to fetch Cards data

    Declaration

    Swift

    public func getCardsData(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletionBlock completionBlock:
            @escaping @MainActor(unsafe) (
                _ cardsData: MoEngageCardsData?,
                _ accountMeta: MoEngageAccountMeta?
            ) -> Void
    )

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with cards data and account info.

  • Method to fetch Cards data. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func getCardsData(
        forAppID appID: String? = nil,
        withCompletionBlock completionBlock:
      @escaping @MainActor(unsafe) (
          _ cardsData: MoEngageCardsData?,
          _ accountMeta: MoEngageAccountMeta?
      ) -> Void
    )
  • Fetch Cards categories

    Declaration

    Swift

    public func getCardsCategories(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletionBlock completionBlock:
            @escaping @MainActor(unsafe) (
                _ categories: [String], _ accountMeta: MoEngageAccountMeta?
            ) -> Void
    )

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with cards categories and account info.

  • Fetch Cards categories. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func getCardsCategories(
        forAppID appID: String? = nil,
        withCompletionBlock completionBlock:
      @escaping @MainActor(unsafe) (
          _ categories: [String], _ accountMeta: MoEngageAccountMeta?
      ) -> Void
    )

Inbox Lifecycle

  • Track impression for loading CardsController

    Declaration

    Swift

    public func cardsViewControllerLoaded(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation
    )

    Parameters

    appID

    MoEngage Account identifier

  • Track impression for loading CardsController. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func cardsViewControllerLoaded(forAppID appID: String? = nil)
  • Dismiss CardsViewController

    Declaration

    Swift

    public func cardsViewControllerDismissed(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation
    )

    Parameters

    appID

    MoEngage Account Identifier

  • Dismiss CardsViewController. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func cardsViewControllerDismissed(forAppID appID: String? = nil)

Cards Count

  • Fetch new cards count

    Declaration

    Swift

    public func getNewCardsCount(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletionBlock completionBlock:
            @escaping @MainActor(unsafe) (
                _ count: Int, _ accountMeta: MoEngageAccountMeta?
            ) -> Void
    )

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with new cards count and account info.

  • Fetch new cards count. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func getNewCardsCount(
        forAppID appID: String? = nil,
        withCompletionBlock completionBlock:
      @escaping @MainActor(unsafe) (
          _ count: Int, _ accountMeta: MoEngageAccountMeta?
      ) -> Void
    )
  • Fetch unclicked cards count

    Declaration

    Swift

    public func getUnclickedCardsCount(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletionBlock completionBlock:
            @escaping @MainActor(unsafe) (
                _ count: Int, _ accountMeta: MoEngageAccountMeta?
            ) -> Void
    )

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with unclicked cards count and account info.

  • Fetch unclicked cards count. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func getUnclickedCardsCount(
        forAppID appID: String? = nil,
        withCompletionBlock completionBlock:
      @escaping @MainActor(unsafe) (
          _ count: Int, _ accountMeta: MoEngageAccountMeta?
      ) -> Void
    )
  • Fetch clicked cards count

    Declaration

    Swift

    public func getClickedCardsCount(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletionBlock completionBlock:
            @escaping @MainActor(unsafe) (
                _ count: Int, _ accountMeta: MoEngageAccountMeta?
            ) -> Void
    )

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    completion block with clicked cards count and account info.

  • Fetch clicked cards count. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func getClickedCardsCount(
        forAppID appID: String? = nil,
        withCompletionBlock completionBlock:
      @escaping @MainActor(unsafe) (
          _ count: Int, _ accountMeta: MoEngageAccountMeta?
      ) -> Void
    )

Delete Cards

Sync Cards

  • Sync the cards from server

    Declaration

    Swift

    public func syncCards(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletion completionBlock: (
            @MainActor(unsafe) (_ success: Bool) -> Void
        )? = nil
    )

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    Returns true if sync is successful else false

  • Sync the cards from server. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func syncCards(
        forAppID appID: String? = nil,
        withCompletion completionBlock: (
      @MainActor(unsafe) (_ success: Bool) -> Void
        )? = nil
    )

    Parameters

    appID

    MoEngage Account Identifier

    completionBlock

    Returns true if sync is successful else false

  • Method to sync the cards with app open interval

    Declaration

    Swift

    public func onAppOpenSync(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletion completionBlock: (
            @MainActor(unsafe) (_ data: MoEngageCardSyncCompleteData?) -> Void
        )? = nil
    )

    Parameters

    appID

    account identifier

    completionBlock

    completion block to be called after sync is performed

  • Method to sync the cards with app open interval. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func onAppOpenSync(
        forAppID appID: String? = nil,
        withCompletion completionBlock: (
      @MainActor(unsafe) (_ data: MoEngageCardSyncCompleteData?) -> Void
        )? = nil
    )
  • Method to track inbox click and sync the cards with inbox load interval

    Declaration

    Swift

    public func onCardSectionLoaded(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletion completionBlock: (
            @MainActor(unsafe) (_ data: MoEngageCardSyncCompleteData?) -> Void
        )? = nil
    )

    Parameters

    appID

    account identifier

    completionBlock

    completion block to be called after sync is performed

  • Method to track inbox click and sync the cards with inbox load interval. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func onCardSectionLoaded(
        forAppID appID: String? = nil,
        withCompletion completionBlock: (
      @MainActor(unsafe) (_ data: MoEngageCardSyncCompleteData?) -> Void
        )? = nil
    )
  • Method to sync the cards with pull to refresh interval

    Declaration

    Swift

    public func refreshCards(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        withCompletion completionBlock: (
            @MainActor(unsafe) (_ data: MoEngageCardSyncCompleteData?) -> Void
        )? = nil
    )

    Parameters

    appID

    account identifier

    completionBlock

    completion block to be called after sync is performed

  • Method to sync the cards with pull to refresh interval. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func refreshCards(
        forAppID appID: String? = nil,
        withCompletion completionBlock: (
      @MainActor(unsafe) (_ data: MoEngageCardSyncCompleteData?) -> Void
        )? = nil
    )

Card Tracking

  • Track cards shown event and update delivery counters accordingly.

    Declaration

    Swift

    public func cardShown(
        _ card: MoEngageCardCampaign,
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation
    )

    Parameters

    card

    instance of MoEngageCardCampaign

    appID

    MoEngage Account Identifier

  • Track cards shown event and update delivery counters accordingly. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func cardShown(
        _ card: MoEngageCardCampaign,
        forAppID appID: String? = nil
    )
  • Mark the card as clicked and tracks an event for statistical purpose.

    Declaration

    Swift

    public func cardClicked(
        _ card: MoEngageCardCampaign,
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation
    )

    Parameters

    card

    instance of MoEngageCardCampaign

    appID

    MoEngage Account Identifier

  • Mark the card as clicked and tracks an event for statistical purpose. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func cardClicked(
        _ card: MoEngageCardCampaign,
        forAppID appID: String? = nil
    )
  • Mark a card as clicked and tracks an event for statistical purpose.

    Declaration

    Swift

    public func cardClicked(
        _ card: MoEngageCardCampaign,
        withWidgetID widgetID: Int,
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation
    )

    Parameters

    card

    instance of MoEngageCardCampaign

    widgetID

    unique identifier for the widget that was clicked

    appID

    MoEngage Account Identifier

  • Mark a card as clicked and tracks an event for statistical purpose. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func cardClicked(
        _ card: MoEngageCardCampaign,
        withWidgetID widgetID: Int,
        forAppID appID: String? = nil
    )
  • Mark card delivered event

    Declaration

    Swift

    public func cardDelivered(
        _ card: MoEngageCardCampaign,
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation
    )

    Parameters

    card

    instance of MoEngageCardCampaign

    appID

    MoEngage Account Identifier

  • Mark card delivered event. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func cardDelivered(
        _ card: MoEngageCardCampaign,
        forAppID appID: String? = nil
    )
  • Method to mark tracking delivery of all cards to inbox.

    Declaration

    Swift

    public func cardDelivered(
        forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation
    )

    Parameters

    appID

    account identifier.

  • Method to mark tracking delivery of all cards to inbox. Objective-C compatible overload.

    Declaration

    Swift

    @_disfavoredOverload
    @objc
    public func cardDelivered(forAppID appID: String? = nil)

UI Methods