Skip to content

PMErrorType's cases are not visible from Swift #14

@tomaskraina

Description

@tomaskraina

Because enum PMErrorType is defined in a very oldschool way, it's not being correctly exposed to Swift and can't be used in a switch statement.

The correct way to define PMErrorType would be to use NS_ENUM macro like this:

typedef NS_ENUM(NSInteger, PMErrorType)
{
    UNKNOWN          = 0, /*Initial value*/
    WRONG_PARMETERS  = 1, /*You have supplied wrong parameters. You use message for details.*/
    HTTP_CONNECTION  = 2, /*There was an error while connecting to the PayMill Service.*/
    API              = 3, /*The PAYMILL API returned an unexpected result.*/
    SAFESTORE        = 4, /*The PAYMILL safe store returned an error. Check the PMSafeStoreErrorCodeKey in the user info dictionary for the specific error. */
    BRIDGE           = 5, /*The PAYMILL JS-Bridge returned an a payment method related error code. Check the PMBridgeErrorCodeKey in the user info dictionary for the specific error. */
    NOT_INIT         = 6, /*You did not initialize the SDK.*/
    INTERNAL         = 7, /*This should never happen. If you encounter it, please send email [email protected] .*/
};

More info on NS_ENUM macro and Swift/ObjC interoperability: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions