SFMCEvent

Objective-C

@interface SFMCEvent : NSObject

Swift

class SFMCEvent : NSObject

Event class

  • Method to return a custom event with key.

    Declaration

    Objective-C

    + (nullable id<SFMCEvent>)customEventWithName:(nonnull NSString *)key;

    Swift

    class func customEvent(withName key: String) -> SFMCEventProtocol?

    Parameters

    key

    The custom event key

  • Method to return a custom event with key and id.

    Declaration

    Objective-C

    + (nullable id<SFMCEvent>)customEventWithName:(nonnull NSString *)key
                                      withEventId:(nonnull NSString *)eventId;

    Swift

    class func customEvent(withName key: String, withEventId eventId: String) -> SFMCEventProtocol?

    Parameters

    key

    The custom event key

  • Method to return a custom event with key and parameters.

    Declaration

    Objective-C

    + (nullable id<SFMCEvent>)
        customEventWithName:(nonnull NSString *)key
             withAttributes:(nonnull NSDictionary<NSString *, id> *)parameters;

    Swift

    class func customEvent(withName key: String, withAttributes parameters: [String : Any] = [:]) -> SFMCEventProtocol?

    Parameters

    key

    The custom event key

    parameters

    Custom event parameters

  • Method to return a custom event with key, id, and parameters.

    Declaration

    Objective-C

    + (nullable id<SFMCEvent>)
        customEventWithName:(nonnull NSString *)key
                withEventId:(nonnull NSString *)eventId
             withAttributes:(nonnull NSDictionary<NSString *, id> *)parameters;

    Swift

    class func customEvent(withName key: String, withEventId eventId: String, withAttributes parameters: [String : Any] = [:]) -> SFMCEventProtocol?

    Parameters

    key

    The custom event key

    parameters

    Custom event parameters

  • Parse and trim parameters for event creation. Validate key, trim, drop if criteria not met.

    Declaration

    Objective-C

    + (nullable NSDictionary<NSString *, id> *)parseAndTrim:
        (nonnull NSDictionary<NSString *, id> *)parameters;

    Swift

    class func parseAndTrim(_ parameters: [String : Any]) -> [String : Any]?

    Parameters

    parameters

    for preparation.

    Return Value

    parsed parameters

  • Validate and prepare the key to meet requirements.

    Declaration

    Objective-C

    + (nullable NSString *)validateAndPrepareKey:(nonnull id)key;

    Swift

    class func validateAndPrepareKey(_ key: Any) -> String?

    Parameters

    key

    The custom event key

    Return Value

    key