MobileAppMessaging

Class

This class is a Swift Interface for SFMobileAppMessaging

Declaration 

1@objc(SFMobileAppMessaging)
2public final class MobileAppMessaging : NSObject, SFMCModule, Publisher
3
4@objc
5public static func requestSdk(_ callback: @escaping (_ mamCore: MobileAppMessagingApi?) -> Void)
6
7public func setRegistrationCallback(_ registrationCallback: @escaping (Dictionary<AnyHashable, Any>) -> Void)
8
9public func unsetRegistrationCallback()
10
11public func deviceIdentifier() -> String?
12
13public func setAnalyticsEnabled(_ enabled: Bool)
14
15public func isAnalyticsEnabled() -> Bool

Request SDK Method 

requestSdk(_:) 

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

1@objc
2public static func requestSdk(_ callback: @escaping (_ mamCore: MobileAppMessagingApi?) -> Void)

Registration Methods 

setRegistrationCallback(_:) 

Register a callback that will be notified when Registration related events happen @param registrationCallback closure to be provided when registration event occurs

1public func setRegistrationCallback(_ registrationCallback: @escaping (Dictionary<AnyHashable, Any>) -> Void)

unsetRegistrationCallback() 

Removes the registration callback

1public func unsetRegistrationCallback()

deviceIdentifier() 

Returns the unique identifier associated with the device.

1public func deviceIdentifier() -> String?

Returns: A String representing the device identifier, or nil if unavailable.


Feature Toggle Methods 

setAnalyticsEnabled(_:) 

Developer override to set the state of analytics enablement. If set false, the SDK will stop tracking analytics and also purges all the analytics stored locally. This value takes precedence over the config setting which is passed during the SDK initialization.

1public func setAnalyticsEnabled(_ enabled: Bool)

isAnalyticsEnabled() 

The current state of the Analytics enablement override

1public func isAnalyticsEnabled() -> Bool

Returns: A BOOL value of the Analytics enablement override considering config setting .