-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46518e1
commit f8c8c29
Showing
131 changed files
with
3,655 additions
and
8,761 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
language: objective-c | ||
osx_image: xcode7.3 | ||
osx_image: xcode8 | ||
|
||
install: | ||
- gem install xcpretty | ||
|
||
script: | ||
- set -o pipefail && xcodebuild -project Bond.xcodeproj -scheme Bond -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0' test | xcpretty | ||
- set -o pipefail && xcodebuild -project Bond.xcodeproj -scheme BondOSX -sdk macosx test | xcpretty | ||
- set -o pipefail && xcodebuild -project Bond.xcodeproj -scheme Bond-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6s,OS=10.0' test | xcpretty | ||
# - set -o pipefail && xcodebuild -project Bond.xcodeproj -scheme BondOSX -sdk macosx test | xcpretty | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,22 @@ | ||
// | ||
// RKDelegate.h | ||
// ReactiveKit | ||
// | ||
// Created by Srdan Rasic on 14/05/16. | ||
// Copyright © 2016 Srdan Rasic. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface RKProtocolProxyBase : NSObject | ||
|
||
@property (nonatomic, readonly, nonnull, strong) Protocol *protocol; | ||
|
||
/// An object conforming to protocol `protocol` to which forward methods calls. | ||
@property (nonatomic, nullable, weak) NSObject *forwardTo; | ||
|
||
- (nonnull instancetype)initWithProtocol:(nonnull Protocol *)protocol; | ||
- (BOOL)hasHandlerForSelector:(nonnull SEL)selector; | ||
- (void)invokeWithSelector:(nonnull SEL)selector argumentExtractor:(void (^_Nonnull)(NSInteger index, void * _Nullable buffer))argumentExtractor setReturnValue:(void (^_Nullable)(void * _Nullable buffer))setReturnValue; | ||
|
||
@end |
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,83 @@ | ||
// | ||
// RKDelegate.m | ||
// ReactiveKit | ||
// | ||
// Created by Srdan Rasic on 14/05/16. | ||
// Copyright © 2016 Srdan Rasic. All rights reserved. | ||
// | ||
|
||
#import "BNDProtocolProxyBase.h" | ||
#import <objc/runtime.h> | ||
|
||
@interface RKProtocolProxyBase () | ||
@property (nonatomic, readwrite, strong) Protocol *protocol; | ||
@end | ||
|
||
@implementation RKProtocolProxyBase | ||
|
||
- (instancetype)initWithProtocol:(Protocol *)protocol | ||
{ | ||
self = [super init]; | ||
if (self) { | ||
_protocol = protocol; | ||
} | ||
return self; | ||
} | ||
|
||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector | ||
{ | ||
NSMethodSignature *signature = [super methodSignatureForSelector:selector]; | ||
|
||
if (!signature && [self hasHandlerForSelector:selector]) { | ||
struct objc_method_description description = protocol_getMethodDescription(self.protocol, selector, NO, YES); | ||
if (description.types == NULL) { | ||
description = protocol_getMethodDescription(self.protocol, selector, YES, YES); | ||
} | ||
signature = [NSMethodSignature signatureWithObjCTypes:description.types]; | ||
} | ||
|
||
if (!signature) { | ||
signature = [self.forwardTo methodSignatureForSelector:selector]; | ||
} | ||
|
||
return signature; | ||
} | ||
|
||
- (BOOL)hasHandlerForSelector:(SEL)selector | ||
{ | ||
return NO; | ||
} | ||
|
||
- (void)invokeWithSelector:(SEL)selector argumentExtractor:(void (^)(NSInteger index, void *buffer))argumentExtractor setReturnValue:(void (^)(void *buffer))setReturnValue | ||
{ | ||
} | ||
|
||
- (void)forwardInvocation:(NSInvocation *)invocation | ||
{ | ||
if ([self hasHandlerForSelector:invocation.selector]) { | ||
if (invocation.methodSignature.methodReturnLength > 0) { | ||
[invocation retainArguments]; | ||
[self invokeWithSelector:invocation.selector argumentExtractor:^(NSInteger index, void *buffer) { | ||
[invocation getArgument:buffer atIndex:index]; | ||
} setReturnValue:^(void *buffer) { | ||
[invocation setReturnValue:buffer]; | ||
}]; | ||
} else { | ||
[self invokeWithSelector:invocation.selector argumentExtractor:^(NSInteger index, void *buffer) { | ||
[invocation getArgument:buffer atIndex:index]; | ||
} setReturnValue:nil]; | ||
} | ||
|
||
if ([self.forwardTo respondsToSelector:invocation.selector]) { | ||
[invocation invokeWithTarget:self.forwardTo]; | ||
} | ||
} else { | ||
if ([self.forwardTo respondsToSelector:invocation.selector]) { | ||
[invocation invokeWithTarget:self.forwardTo]; | ||
} else { | ||
[super forwardInvocation:invocation]; | ||
} | ||
} | ||
} | ||
|
||
@end |
Oops, something went wrong.