Type Definitions

The following type definitions are available globally.

  • Represents a method that returns a dictionary with initials and profiles for a given personalization.

    Declaration

    Objective-C

    typedef NSDictionary * (^InitialsBuilder)(NSString *_Nonnull,
                                              NSString *_Nonnull,
                                              UIImageView *_Nonnull)

    Swift

    typealias InitialsBuilder = (String, String, UIImageView) -> [AnyHashable : Any]?

    Parameters

    initials

    The initials of the personalization.

    engraving

    The engraving of the personalization.

    image

    The UIImageView where the personalization will be shown.

    Return Value

    A Dictionary with the initials as NSString and profile as an NSArray of NSString.

  • A function to be executed when an event.

    It receives a dictionary with the response as parameter and returns a promise which is resolved asynchronously.

    Declaration

    Objective-C

    typedef Promise * (^Callback)(NSDictionary *_Nonnull)

    Swift

    typealias Callback = ([AnyHashable : Any]) -> Promise?

    Parameters

    response

    A dictionary with the payload of the event

    Return Value

    A Promise that may be resolved asynchronously

  • Declaration of the Resolve block, used to resolve a promise with a result.

    Declaration

    Objective-C

    typedef void (^Resolve)(id _Nullable)

    Swift

    typealias Resolve = (Any?) -> Void

    Parameters

    result

    The result of the promise.

  • Declaration of the Reject block, used to reject a promise with an error.

    Declaration

    Objective-C

    typedef void (^Reject)(NSError *_Nonnull)

    Swift

    typealias Reject = (Error) -> Void

    Parameters

    error

    The error that caused the rejection.

  • Declaration of the Resolved block, used to handle the result of a promise.

    Declaration

    Objective-C

    typedef void (^Resolved)(id _Nullable)

    Swift

    typealias Resolved = (Any?) -> Void

    Parameters

    result

    The result of the promise.

  • Declaration of the Rejected block, used to handle the rejection of a promise.

    Declaration

    Objective-C

    typedef void (^Rejected)(NSError *_Nonnull)

    Swift

    typealias Rejected = (Error) -> Void

    Parameters

    error

    The error of the promise.

  • Declaration of the Executor block, used to resolve or reject a promise.

    Declaration

    Objective-C

    typedef void (^Executor)(Resolve _Nonnull, Reject _Nonnull)

    Swift

    typealias Executor = (Resolve, Reject) -> Void

    Parameters

    resolve

    The Resolve block to be called with a result.

    reject

    The Reject block to be called with an error.