Swift Package Index


Catch Objective-C exceptions by NSException subtype in a Swift closure/function.


  • The latest stable release is 2.0.0. Released over 1 year ago.
  • The last commit to master was over 1 year ago.

Swift Version Compatibility

  • 2.0.0 and master
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • 2.0.0 and master
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

CwlCatchException

A simple Swift wrapper around an Objective-C @try/@catch statement that selectively catches Objective-C exceptions by NSException subtype, rethrowing if any caught exception is not the expected subtype.

Look at CwlCatchExceptionTests.swift for syntax.

Requirements

From version 2.0.0-beta.1, building CwlCatchException requires Swift 5 or newer and the Swift Package Manager.

For use with older versions of Swift or other package managers, use version 1.2.0 or older.

Adding to your project

Add the following to the dependencies array in your "Package.swift" file:

 .package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: Version("2.0.0-beta.1"))

Or by adding https://github.com/mattgallagher/CwlCatchException.git, version 2.0.0-beta.1 or later, to the list of Swift packages for any project in Xcode.