Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMErrorType's cases are not visible from Swift #14

Open
tomaskraina opened this issue Jun 22, 2016 · 0 comments
Open

PMErrorType's cases are not visible from Swift #14

tomaskraina opened this issue Jun 22, 2016 · 0 comments

Comments

@tomaskraina
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant