Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
SirWellington committed Apr 7, 2016
2 parents 9e948d8 + e4ce289 commit 8086fc5
Show file tree
Hide file tree
Showing 12 changed files with 762 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
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")
}

```
18 changes: 18 additions & 0 deletions SwiftExceptionCatcher.podspec
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
Loading

0 comments on commit 8086fc5

Please sign in to comment.