Skip to content

Simple utility that allows catching Objective C Exceptions in Swift

Notifications You must be signed in to change notification settings

jonbrooks/ObjCTryCatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ObjCTryCatch

Simple utility that allows catching Objective C Exceptions in Swift

This utility converts Objective C exeption throwing blocks into swift-style throwing block.

Installation

with Carthage:

github "jonbrooks/ObjCTryCatch" "master"

Usage

For blocks that don't return anything:

do {
    try ObjCTry.doTry {
        //Some Objective C API that might throw...  
    }
} catch {
    debugPrint(error)
}

For blocks that return an Objective C Object:

let myObj = try? ObjCTry.doTryObj {
    //Some Objective C API that returns an object
}

About

Simple utility that allows catching Objective C Exceptions in Swift

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published