{"action":"opened","issue":{"url":"https://api.github.com/repos/paymill/paymill-ios/issues/14","repository_url":"https://api.github.com/repos/paymill/paymill-ios","labels_url":"https://api.github.com/repos/paymill/paymill-ios/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/paymill/paymill-ios/issues/14/comments","events_url":"https://api.github.com/repos/paymill/paymill-ios/issues/14/events","html_url":"https://github.com/paymill/paymill-ios/issues/14","id":161634050,"number":14,"title":"PMErrorType's cases are not visible from Swift","user":{"login":"tomaskraina","id":198316,"avatar_url":"https://avatars.githubusercontent.com/u/198316?v=3","gravatar_id":"","url":"https://api.github.com/users/tomaskraina","html_url":"https://github.com/tomaskraina","followers_url":"https://api.github.com/users/tomaskraina/followers","following_url":"https://api.github.com/users/tomaskraina/following{/other_user}","gists_url":"https://api.github.com/users/tomaskraina/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaskraina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaskraina/subscriptions","organizations_url":"https://api.github.com/users/tomaskraina/orgs","repos_url":"https://api.github.com/users/tomaskraina/repos","events_url":"https://api.github.com/users/tomaskraina/events{/privacy}","received_events_url":"https://api.github.com/users/tomaskraina/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-22T09:29:38Z","updated_at":"2016-06-22T09:29:38Z","closed_at":null,"body":"Because [`enum PMErrorType` is defined in a very oldschool way](https://github.com/paymill/paymill-ios/blob/master/samples/vouchermill/PayMillSDK/PayMillSDK.framework/Versions/A/Headers/PMError.h#L26), it's not being correctly exposed to Swift and can't be used in a `switch` statement.\r\n\r\nThe correct way to define `PMErrorType` would be to use `NS_ENUM` macro like this:\r\n\r\n```c\r\ntypedef NS_ENUM(NSInteger, PMErrorType)\r\n{\r\n    UNKNOWN          = 0, /*Initial value*/\r\n\tWRONG_PARMETERS  = 1, /*You have supplied wrong parameters. You use message for details.*/\r\n\tHTTP_CONNECTION  = 2, /*There was an error while connecting to the PayMill Service.*/\r\n\tAPI              = 3, /*The PAYMILL API returned an unexpected result.*/\r\n    SAFESTORE        = 4, /*The PAYMILL safe store returned an error. Check the PMSafeStoreErrorCodeKey in the user info dictionary for the specific error. */\r\n\tBRIDGE           = 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. */\r\n\tNOT_INIT         = 6, /*You did not initialize the SDK.*/\r\n\tINTERNAL         = 7, /*This should never happen. If you encounter it, please send email support@paymill.com .*/\r\n};\r\n```\r\n\r\nMore info on `NS_ENUM` macro and Swift/ObjC interoperability: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html"}}
{"actor":{"display_login":"tomaskraina"}}