Skip to content

CasperMok/SwiftTryCatch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftTryCatch

Adds try/catch support for Swift.

Simple wrapper built around Objective-C @try/@catch/@finally.

##Usage

Install via Cocoapods

pod 'SwiftTryCatch'

Create bridging header (not necessary if using use_frameworks! flag in PodFile)

  • When prompted with "Would you like to configure an Obj-C bridging header?", press "Yes".

  • Go to bridging header and add:

      #import "SwiftTryCatch.h"
    

Use

SwiftTryCatch.tryRun({
         // try something
     }, catchRun: { (error) in
         println("\(error.description)")
     }, finallyRun: {
         // close resources
})

About

Adds try-catch support for Swift

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Objective-C 85.9%
  • Ruby 14.1%