-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
762 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,32 @@ | ||
# SwiftExceptionCatcher | ||
# SwiftExceptionCatcher | ||
|
||
[<img src="http://brand.redroma.tech/Logos/RedRoma-Logo%402x.png | ||
" width="300">](https://RedRoma.tech) | ||
|
||
`SwiftExceptionCatcher` allows Swift Code to catch exceptions thrown from Objective-C code. | ||
|
||
This is useful when using Thrift libraries, where it is perfectly normal for code to throw `NSException` types. | ||
|
||
|
||
# Cocoapods | ||
```xml | ||
pod 'SwiftExceptionCatcher', :git => 'https://github.com/RedRoma/SwiftExceptionCatcher.git' | ||
``` | ||
|
||
# API | ||
Simply wrap the code-in-play in the `tryOp` function call. | ||
|
||
```js | ||
var object: SomeObjectThatThrows | ||
... | ||
do { | ||
try tryOp() { object.act() } | ||
} | ||
catch let ex is AromaException { | ||
print("Aroma Failed: \(ex") | ||
} | ||
catch let ex { | ||
print("Exception: \(ex") | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Pod::Spec.new do |spec| | ||
spec.name = "SwiftExceptionCatcher" | ||
spec.module_name = 'SwiftExceptionCatcher' | ||
spec.version = "1.0" | ||
spec.summary = "Catch NSException with Swift" | ||
spec.homepage = "https://github.com/RedRoma/SwiftExceptionCatcher" | ||
spec.license = "Code is Licensed under Apache 2.0" | ||
spec.author = { "SirWellington" => "wellington@redroma.tech" } | ||
spec.source = | ||
{ | ||
:path => "SwiftExceptionCatcher/SwiftExceptionCatcher/" | ||
} | ||
spec.source_files = "SwiftExceptionCatcher/SwiftExceptionCatcher/*.{h,m,swift}" | ||
# spec.resources = 'Pod/Assets/*' | ||
|
||
spec.platform = :ios, '8.0', :osx, '10.8' | ||
spec.requires_arc = false | ||
end |
Oops, something went wrong.