-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Swift bridging for RACSignalError using NS_ERROR_ENUM #150
Support Swift bridging for RACSignalError using NS_ERROR_ENUM #150
Conversation
There’s a potential breaking change here: the symbols |
Discoved |
2145ce1
to
9014a17
Compare
The
Updating to CocoaPods 1.6.0.beta.2 locally resolved the error for me. |
For some reason, switching to The CocoaPods thing is still there, but I’m comfortable ignoring it until 1.6.0 is released. |
@@ -2579,13 +2600,19 @@ | |||
"DTRACE_PROBES_DISABLED=1", | |||
); | |||
INFOPLIST_FILE = ReactiveObjC/Info.plist; | |||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed, I don't think. It should already be specified in the xcconfig
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this was probably an automatic Xcode change when adding the first Swift code to the target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed all the redundant LD_RUNPATH_SEARCH_PATHS
settings in commit 31e9f4a.
@@ -28,7 +28,7 @@ - (instancetype)initWithBlock:(id)block { | |||
+ (id)invokeBlock:(id)block withArguments:(RACTuple *)arguments { | |||
NSCParameterAssert(block != NULL); | |||
|
|||
RACBlockTrampoline *trampoline = [[self alloc] initWithBlock:block]; | |||
RACBlockTrampoline *trampoline = [(RACBlockTrampoline *)[self alloc] initWithBlock:block]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While debugging the pod lib lint
failures on CI I noticed warnings like this:
- WARN | [iOS] xcodebuild: /Users/travis/build/ReactiveCocoa/ReactiveObjC/ReactiveObjC/RACBlockTrampoline.m:31:49: warning: 'initWithBlock:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
This is a false positive, because it’s confusing our -[RACBlockTrampoline initWithBlock:]
selector for something like -[NSThread initWithBlock:]
, which has only been available since iOS 10. Adding the explicit cast shouldn’t be necessary (this seems like a compiler/analyser bug), but it does remove the warning.
public let RACSignalErrorNoMatchingCase = RACSignalError.noMatchingCase.rawValue | ||
|
||
@available(*, deprecated, renamed: "RACSignalError.timedOut") | ||
public let RACSignalErrorTimedOut = RACSignalError.timedOut.rawValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems great. 👏
d0dbcc8
to
d8fb1f6
Compare
PRODUCT_NAME = "$(PROJECT_NAME)Tests"; | ||
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | ||
SWIFT_VERSION = 4.2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could potentially lower this version to 4.0 or even 3.0 to keep support for compiling with older Xcode versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that's important.
This looks good once the |
@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? |
I'm fine with that. 👍🏻 Merge at your leisure! |
Oh weird, looks like I don’t have write access for ReactiveObjC? |
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.
This allows us to use CocoaPods 1.6.0.beta, which fixes a bug in `pod lib lint` under Xcode 10.
697cb5f
to
7b150ab
Compare
Just invited you to the right team for that! |
@mdiep Thanks! |
…dging Support Swift bridging for RACSignalError using NS_ERROR_ENUM
Redefines
RACSignalError
usingNS_ERROR_ENUM
, allowing it to bridge to Swift as a newRACSignalError
struct containing static instances ofRACSignalError.Code
, and allowing it to be used in error pattern matching contexts.