|
| 1 | +# CwlCatchException |
| 2 | +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. |
| 3 | + |
| 4 | +Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/CwlCatchExceptionTests/CwlCatchExceptionTests.swift?ts=4) for syntax. |
| 5 | + |
| 6 | +## Adding to your project |
| 7 | + |
| 8 | +This project can be used by direct inclusion in your projects or through any of the Swift Package Manager, CocoaPods or Carthage. |
| 9 | + |
| 10 | +Minimum requirements are iOS 8 or macOS 10.9. |
| 11 | + |
| 12 | +### Manual inclusion |
| 13 | + |
| 14 | +1. In a subdirectory of your project's directory, run `git clone https://github.com/mattgallagher/CwlCatchException.git` |
| 15 | +2. Drag the "CwlCatchException.xcodeproj" file from the Finder into your own project's file tree in Xcode |
| 16 | +3. Add the "CwlCatchException.framework" from the "Products" folder of the CwlCatchException project's file tree to the "Copy Files (Frameworks)" build phases of any target that you want to include this module. |
| 17 | + |
| 18 | +That third step is a little tricky if you're unfamiliar with Xcode but it involves: |
| 19 | + |
| 20 | +a. click on your project in the file tree |
| 21 | +b. click on the target to whih you want to add this module |
| 22 | +c. select the "Build Phases" tab |
| 23 | +d. if you don't already have a "Copy File" build phase with a "Destination: Frameworks", add one using the "+" button in the top left of the tab |
| 24 | +e. click the "+" within the "Copy File (Frameworks)" phase and from the list that appears, select the "CwlCatchException.framework" (if there are multiple frameworks with the same name, look for the one that appears *above* the corresponding macOS or iOS CwlCatchException testing target). |
| 25 | + |
| 26 | +### Swift Package Manager |
| 27 | + |
| 28 | +Add the following to the `dependencies` array in your "Package.swift" file: |
| 29 | + |
| 30 | + .Package(url: "https://github.com/mattgallagher/CwlCatchException.git", majorVersion: 1), |
| 31 | + |
| 32 | +Or, if you're using the `swift-tools-version:4.0` package manager, add the following to the `dependencies` array in your "Package.swift" file: |
| 33 | + |
| 34 | + .package(url: "https://github.com/mattgallagher/CwlCatchException.git", majorVersion: 1) |
| 35 | + |
| 36 | +### CocoaPods |
| 37 | + |
| 38 | +Add the following to your target in your "Podfile": |
| 39 | + |
| 40 | + pod 'CwlCatchException', :git => 'https://github.com/mattgallagher/CwlCatchException.git' |
| 41 | + |
| 42 | +### Carthage |
| 43 | + |
| 44 | +Add the following line to your Cartfile: |
| 45 | + |
| 46 | + git "https://github.com/mattgallagher/CwlCatchException.git" "master" |
0 commit comments