williamFalcon / SwiftTryCatch

Adds try-catch support for Swift
MIT License
140 stars 58 forks source link

"try" is a reserved word in Swift 2 #7

Closed DanieleCeglia closed 8 years ago

DanieleCeglia commented 8 years ago

Hello I'm trying to use SwiftTryCatch via Cocoapods, but in Xcode 7.3 this code won't compile:

SwiftTryCatch.try(
     {
         // stuff...
     },
     catch:
     { (exception) in
         // stuff...
     },
     finally:
     {
         // stuff...
     }
 )

I suggest to rename try in tryBlock, catch in catchBlock and finally in finallyBlock...

joshavant commented 8 years ago

For those landing on this question in the future, you'll need to escape 'try', like so:

SwiftTryCatch.`try`(
     {
         // stuff...
     },
     catch:
     { (exception) in
         // stuff...
     },
     finally:
     {
         // stuff...
     }
 )
DanieleCeglia commented 8 years ago

Ok, thanks!

souzainf3 commented 8 years ago

Use https://github.com/inthepocket/SwiftTryCatch.git or hang on "pull request".

williamFalcon commented 8 years ago

Merged pull request