-
Notifications
You must be signed in to change notification settings - Fork 496
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Swift bridging for RACSignalError using NS_ERROR_ENUM
Redefines `RACSignalError` using `NS_ERROR_ENUM`, allowing it to bridge to Swift as a new `RACSignalError` struct containing static instances of `RACSignalError.Code`, and allowing it to be used in error pattern matching contexts.
- Loading branch information
Showing
4 changed files
with
73 additions
and
15 deletions.
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
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
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
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,19 @@ | ||
import Quick | ||
import Nimble | ||
import ReactiveObjC | ||
|
||
final class RACSwiftBridgingSpec: QuickSpec { | ||
override func spec() { | ||
describe("RACSignalError") { | ||
it("bridges RACSignalErrorTimedOut to a Swift error code") { | ||
let error: Error = NSError(domain: RACSignalErrorDomain, code: 1) | ||
expect(RACSignalError.timedOut ~= error).to(beTrue()) | ||
} | ||
|
||
it("bridges RACSignalErrorNoMatchingCase to a Swift error code") { | ||
let error: Error = NSError(domain: RACSignalErrorDomain, code: 2) | ||
expect(RACSignalError.noMatchingCase ~= error).to(beTrue()) | ||
} | ||
} | ||
} | ||
} |