Skip to content

Commit a621018

Browse files
authored
Merge pull request ReactiveCocoa#150 from sharplet/as-swift-error-bridging
Support Swift bridging for RACSignalError using NS_ERROR_ENUM
2 parents 5f2817f + 7b150ab commit a621018

16 files changed

+222
-63
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode9
2+
osx_image: xcode10
33
before_install: true
44
install: true
55
branches:
@@ -24,7 +24,7 @@ matrix:
2424
env:
2525
- XCODE_SDK=appletvsimulator
2626
- XCODE_ACTION="build-for-testing test-without-building"
27-
- XCODE_DESTINATION="platform=tvOS Simulator,name=Apple TV 1080p"
27+
- XCODE_DESTINATION="platform=tvOS Simulator,name=Apple TV 4K"
2828
- xcode_scheme: ReactiveObjC-watchOS
2929
env:
3030
- XCODE_SDK=watchsimulator
@@ -55,6 +55,7 @@ matrix:
5555
env:
5656
- JOB=CARTHAGE-watchOS
5757
- script:
58+
- gem install cocoapods --pre
5859
- pod repo update --silent
5960
- pod lib lint ReactiveObjC.podspec
6061
env:

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
github "Quick/Nimble" "v7.0.2"
1+
github "Quick/Nimble" "v7.3.1"
22
github "Quick/Quick" "v1.2.0"
33
github "jspahrsummers/xcconfigs" "3d9d99634cae6d586e272543d527681283b33eb0"

Carthage/Checkouts/Nimble

Submodule Nimble updated 105 files

ReactiveObjC.xcodeproj/project.pbxproj

Lines changed: 134 additions & 27 deletions
Large diffs are not rendered by default.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// Deprecations+Removals.swift
3+
// ReactiveObjC
4+
//
5+
// Created by Adam Sharp on 26/12/18.
6+
// Copyright © 2018 GitHub. All rights reserved.
7+
//
8+
9+
@available(*, deprecated, renamed: "RACSignalError.notEnabled")
10+
public let RACCommandErrorNotEnabled = RACCommandError.notEnabled.rawValue
11+
12+
@available(*, deprecated, renamed: "RACSignalError.methodSwizzlingRace")
13+
public let RACSelectorSignalErrorMethodSwizzlingRace = RACSelectorSignalError.methodSwizzlingRace
14+
15+
@available(*, deprecated, renamed: "RACSignalError.noMatchingCase")
16+
public let RACSignalErrorNoMatchingCase = RACSignalError.noMatchingCase.rawValue
17+
18+
@available(*, deprecated, renamed: "RACSignalError.timedOut")
19+
public let RACSignalErrorTimedOut = RACSignalError.timedOut.rawValue

ReactiveObjC/NSObject+RACAppKitBindings.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ - (instancetype)initWithTarget:(id)target bindingName:(NSString *)bindingName op
9393

9494
@weakify(self);
9595

96-
void (^cleanUp)() = ^{
96+
void (^cleanUp)(void) = ^{
9797
@strongify(self);
9898

9999
id target = self.target;

ReactiveObjC/NSObject+RACKVOWrapper.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ - (RACDisposable *)rac_observeKeyPath:(NSString *)keyPath options:(NSKeyValueObs
5454

5555
BOOL isObject = attributes->objectClass != nil || strstr(attributes->type, @encode(id)) == attributes->type;
5656
BOOL isProtocol = attributes->objectClass == NSClassFromString(@"Protocol");
57-
BOOL isBlock = strcmp(attributes->type, @encode(void(^)())) == 0;
57+
BOOL isBlock = strcmp(attributes->type, @encode(void(^)(void))) == 0;
5858
BOOL isWeak = attributes->weak;
5959

6060
// If this property isn't actually an object (or is a Class object),

ReactiveObjC/NSObject+RACSelectorSignal.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@
1414
NS_ASSUME_NONNULL_BEGIN
1515

1616
/// The domain for any errors originating from -rac_signalForSelector:.
17-
extern NSString * const RACSelectorSignalErrorDomain;
17+
extern NSErrorDomain const RACSelectorSignalErrorDomain;
1818

19-
/// -rac_signalForSelector: was going to add a new method implementation for
20-
/// `selector`, but another thread added an implementation before it was able to.
21-
///
22-
/// This will _not_ occur for cases where a method implementation exists before
23-
/// -rac_signalForSelector: is invoked.
24-
extern const NSInteger RACSelectorSignalErrorMethodSwizzlingRace;
19+
typedef NS_ERROR_ENUM(RACSelectorSignalErrorDomain, RACSelectorSignalError) {
20+
/// -rac_signalForSelector: was going to add a new method implementation for
21+
/// `selector`, but another thread added an implementation before it was able to.
22+
///
23+
/// This will _not_ occur for cases where a method implementation exists before
24+
/// -rac_signalForSelector: is invoked.
25+
RACSelectorSignalErrorMethodSwizzlingRace = 1,
26+
};
2527

2628
@interface NSObject (RACSelectorSignal)
2729

ReactiveObjC/NSObject+RACSelectorSignal.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
#import <objc/message.h>
1919
#import <objc/runtime.h>
2020

21-
NSString * const RACSelectorSignalErrorDomain = @"RACSelectorSignalErrorDomain";
22-
const NSInteger RACSelectorSignalErrorMethodSwizzlingRace = 1;
21+
NSErrorDomain const RACSelectorSignalErrorDomain = @"RACSelectorSignalErrorDomain";
2322

2423
static NSString * const RACSignalForSelectorAliasPrefix = @"rac_alias_";
2524
static NSString * const RACSubclassSuffix = @"_RACSelectorSignal";

ReactiveObjC/RACBlockTrampoline.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ - (instancetype)initWithBlock:(id)block {
2828
+ (id)invokeBlock:(id)block withArguments:(RACTuple *)arguments {
2929
NSCParameterAssert(block != NULL);
3030

31-
RACBlockTrampoline *trampoline = [[self alloc] initWithBlock:block];
31+
RACBlockTrampoline *trampoline = [(RACBlockTrampoline *)[self alloc] initWithBlock:block];
3232
return [trampoline invokeWithArguments:arguments];
3333
}
3434

0 commit comments

Comments
 (0)