ReactiveCocoa / ReactiveObjC

The 2.x ReactiveCocoa Objective-C API: Streams of values over time
MIT License
2.6k stars 496 forks source link

Support Swift bridging for RACSignalError using NS_ERROR_ENUM #150

Closed sharplet closed 5 years ago

sharplet commented 5 years ago

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.

sharplet commented 5 years ago

There’s a potential breaking change here: the symbols RACSignalErrorNoMatchingCase and RACSignalErrorTimedOut will no longer be available to Swift. I pushed commit 2334221, which adds them back in with a deprecated+renamed warning. Any thoughts on whether this is necessary? The downside is that it adds Swift code to a previously ObjC-only framework, which could cause build errors.

sharplet commented 5 years ago

Discoved RACCommandErrorDomain and RACSelectorSignalErrorDomain and added bridging for those as well.

sharplet commented 5 years ago

The pod lib lint failure appears to be a CocoaPods bug (https://github.com/CocoaPods/CocoaPods/issues/8089):

 -> ReactiveObjC (3.1.0)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Planning build
    - NOTE  | xcodebuild:  note: Constructing build description
    - NOTE  | xcodebuild:  warning: Capabilities for App may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the build settings editor. (in target 'App')
    - NOTE  | xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file. (in target 'App')
    - ERROR | [OSX] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.

Updating to CocoaPods 1.6.0.beta.2 locally resolved the error for me.

sharplet commented 5 years ago

For some reason, switching to Apple TV 4K instead of Apple TV 1080p worked, even though Apple TV 1080p clearly seemed to be in the list of available destinations.

The CocoaPods thing is still there, but I’m comfortable ignoring it until 1.6.0 is released.

mdiep commented 5 years ago

This looks good once the pod lib lint is fixed.

sharplet commented 5 years ago

@mdiep To fix it, we would either need to use a prerelease version of CocoaPods on CI or wait for 1.6.0 to land. With CocoaPods on a longer beta cycle, I’m not sure how long that will be.

Any preference?

mdiep commented 5 years ago

I'm fine with that. 👍🏻 Merge at your leisure!

sharplet commented 5 years ago

Oh weird, looks like I don’t have write access for ReactiveObjC?

mdiep commented 5 years ago

Oh weird, looks like I don’t have write access for ReactiveObjC?

Just invited you to the right team for that!

sharplet commented 5 years ago

@mdiep Thanks!