Swiftpack.co - mattgallagher/CwlCatchException as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Catch Objective-C exceptions by NSException subtype in a Swift closure/function.
.package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: "2.1.1")


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.


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

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

Adding to your project

Swift Package Manager

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"))

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


CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate CwlCatchException into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'CwlCatchException', '~> 2.0'


Includes contributions from @alexbaev, @dnkoutso and @ejensen.


Stars: 9
Last commit: 2 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics