SFMCSdk

@objc(SFMCSdk)
public final class SFMCSdk : NSObject

SFMCSDK Modules

SFMCSDK Methods

Logger Methods

File Protection Helpers

  • Provides a way to set/override the Protection level for File system

    Declaration

    Swift

    @objc
    public static func setFileProtectionType(fileProtectionType: FileProtectionType?)

    Parameters

    fileProtectionType

    FileProtectionType which has any one of the below values NSFileProtectionComplete NSFileProtectionCompleteUnlessOpen NSFileProtectionCompleteUntilFirstUserAuthentication NSFileProtectionNone

  • Returns File protection type set by the SDK or overridden value by the consuming application

    Declaration

    Swift

    @objc
    public static func fileProtectionType() -> FileProtectionType?

SDK Getters

  • Requests the Personalization Module/SDK when it’s operational and safe to use. The provided callback will be invoked when Personalization is ready. The host app shouldn’t normally need to use this, as the Personalization module itself already does this for async operations, like fetching decisions/personalization. As Personalization intentionally doesn’t expose much functionality to the base SFMCSdk, one could use PersonalizationModule.shared within the callback code to use module-specific functionality.

    Declaration

    Swift

    @objc
    public static func requestPersonalizationSdk(_ callback: @escaping () -> Void)

    Parameters

    callback

    The callback/task to run when Personalization is ready.

  • Requests the CDP Module/SDK when it’s operational and safe to use. The provided callback will be invoked when CDP Is ready.

    Declaration

    Swift

    @objc
    public static func requestCdpSdk(_ callback: @escaping (_ cdp: CdpInterface) -> Void)

    Parameters

    callback

    The callback/task to run when CDP is ready.

User Triggered Events

  • Tracks a custom event which are dispatched to all registered SDK modules.

    Events are processed asynchronously and may be batched before being sent to the network.

    Use [sendImmediate] for time-sensitive events that should bypass normal queuing.

    Declaration

    Swift

    @objc
    public static func track(event: Event)

    Parameters

    event

    custom event to track

  • Tracks a custom event at high priority and schedules it to be sent to the server along with any other pending events in the queue. Unlike [track], this attempts to deliver queued events promptly rather than waiting for the next scheduled interval.

    This API is subject to SDK guardrails — there is a 60-second throttling period between consecutive calls. Use it only when timely delivery is important.

    Declaration

    Swift

    @objc
    public static func sendImmediate(event: Event)

    Parameters

    event

    custom event to track at high priority

  • Schedules a flush of any queued events. The flush is subject to SDK guardrails — notably, a 60-second throttling period between consecutive flush calls. If a flush was recently performed, the request will be deferred until the throttle window has elapsed.

    Use this only when prompt delivery is critical.

    Calling it frequently will not accelerate delivery and may be throttled by the SDK.

    Declaration

    Swift

    @objc
    public static func flush()