Skip to content

Commit f8c8c29

Browse files
committed
Initial Bond v5 work
1 parent 46518e1 commit f8c8c29

File tree

131 files changed

+3655
-8761
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+3655
-8761
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
language: objective-c
2-
osx_image: xcode7.3
2+
osx_image: xcode8
33

44
install:
55
- gem install xcpretty
66

77
script:
8-
- set -o pipefail && xcodebuild -project Bond.xcodeproj -scheme Bond -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0' test | xcpretty
9-
- set -o pipefail && xcodebuild -project Bond.xcodeproj -scheme BondOSX -sdk macosx test | xcpretty
8+
- set -o pipefail && xcodebuild -project Bond.xcodeproj -scheme Bond-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6s,OS=10.0' test | xcpretty
9+
# - set -o pipefail && xcodebuild -project Bond.xcodeproj -scheme BondOSX -sdk macosx test | xcpretty
1010

1111
after_success:
1212
- bash <(curl -s https://codecov.io/bash)

Bond.podspec

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
Pod::Spec.new do |s|
22

33
s.name = "Bond"
4-
s.version = "4.3.1"
4+
s.version = "5.0.0-beta1"
55
s.summary = "A Swift binding framework"
66

77
s.description = <<-DESC
8-
Bond is a Swift reactive binding framework that takes binding concept to a whole new level - boils it down to just one operator. It's simple, powerful, type-safe and multi-paradigm - just like Swift.
8+
Bond is a Swift reactive binding framework that takes binding concept to a whole new level.
9+
It's simple, powerful, type-safe and multi-paradigm - just like Swift.
910
10-
Bond was created with two goals in mind: simple to use and simple to understand.
11-
One might argue whether the former implies the latter, but Bond will save you some thinking because both are true in this case.
12-
Its foundation is one simple class - everything else are extensions and syntactic sugars.
11+
Bond is also a framework that bridges the gap between the reactive and imperative paradigms.
12+
You can use it as a standalone framework to simplify your state changes with bindings and reactive data sources,
13+
but you can also use it with ReactiveKit to complement your reactive data flows with bindings and
14+
reactive delegates and data sources.
1315
DESC
1416

1517
s.homepage = "https://github.com/SwiftBond/Bond"
@@ -19,13 +21,12 @@ Pod::Spec.new do |s|
1921
s.ios.deployment_target = "8.0"
2022
s.osx.deployment_target = "10.10"
2123
s.tvos.deployment_target = '9.0'
22-
s.source = { :git => "https://github.com/SwiftBond/Bond.git", :tag => "v4.3.1" }
23-
s.source_files = ["Bond", "Bond/Core", "Bond/Extensions/Shared", "Bond/Extensions/OSX", "Bond/Extensions/iOS"]
24-
s.ios.exclude_files = "Bond/Extensions/OSX"
25-
s.tvos.exclude_files = "Bond/Extensions/OSX"
26-
s.osx.exclude_files = "Bond/Extensions/iOS"
27-
s.framework = 'SystemConfiguration'
28-
s.exclude_files = "Classes/Exclude"
24+
s.source = { :git => "https://github.com/SwiftBond/Bond.git", :tag => "v5.0.0-beta1" }
25+
s.source_files = 'Sources/*.swift', 'Bond/*.{h,m,swift}'
26+
s.ios.exclude_files = "Sources/AppKit"
27+
s.tvos.exclude_files = "Sources/AppKit"
28+
s.osx.exclude_files = "Sources/UIKit"
2929
s.requires_arc = true
3030

31+
s.dependency 'ReactiveKit', '~> 3.0.0-beta1'
3132
end

Bond.xcodeproj/project.pbxproj

+530-1,182
Large diffs are not rendered by default.

Bond.xcodeproj/xcshareddata/xcschemes/Bond.xcscheme renamed to Bond.xcodeproj/xcshareddata/xcschemes/Bond-iOS.xcscheme

+11-26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -14,23 +14,9 @@
1414
buildForAnalyzing = "YES">
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
17-
BlueprintIdentifier = "69491BAD1A7C217100A13B6B"
17+
BlueprintIdentifier = "16210A3B1D3EC474004AEDF3"
1818
BuildableName = "Bond.framework"
19-
BlueprintName = "Bond"
20-
ReferencedContainer = "container:Bond.xcodeproj">
21-
</BuildableReference>
22-
</BuildActionEntry>
23-
<BuildActionEntry
24-
buildForTesting = "YES"
25-
buildForRunning = "NO"
26-
buildForProfiling = "NO"
27-
buildForArchiving = "NO"
28-
buildForAnalyzing = "NO">
29-
<BuildableReference
30-
BuildableIdentifier = "primary"
31-
BlueprintIdentifier = "69491BB81A7C217100A13B6B"
32-
BuildableName = "BondTests.xctest"
33-
BlueprintName = "BondTests"
19+
BlueprintName = "Bond-iOS"
3420
ReferencedContainer = "container:Bond.xcodeproj">
3521
</BuildableReference>
3622
</BuildActionEntry>
@@ -40,14 +26,13 @@
4026
buildConfiguration = "Debug"
4127
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4228
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43-
shouldUseLaunchSchemeArgsEnv = "YES"
44-
codeCoverageEnabled = "YES">
29+
shouldUseLaunchSchemeArgsEnv = "YES">
4530
<Testables>
4631
<TestableReference
4732
skipped = "NO">
4833
<BuildableReference
4934
BuildableIdentifier = "primary"
50-
BlueprintIdentifier = "69491BB81A7C217100A13B6B"
35+
BlueprintIdentifier = "16210A441D3EC474004AEDF3"
5136
BuildableName = "BondTests.xctest"
5237
BlueprintName = "BondTests"
5338
ReferencedContainer = "container:Bond.xcodeproj">
@@ -57,9 +42,9 @@
5742
<MacroExpansion>
5843
<BuildableReference
5944
BuildableIdentifier = "primary"
60-
BlueprintIdentifier = "69491BAD1A7C217100A13B6B"
45+
BlueprintIdentifier = "16210A3B1D3EC474004AEDF3"
6146
BuildableName = "Bond.framework"
62-
BlueprintName = "Bond"
47+
BlueprintName = "Bond-iOS"
6348
ReferencedContainer = "container:Bond.xcodeproj">
6449
</BuildableReference>
6550
</MacroExpansion>
@@ -79,9 +64,9 @@
7964
<MacroExpansion>
8065
<BuildableReference
8166
BuildableIdentifier = "primary"
82-
BlueprintIdentifier = "69491BAD1A7C217100A13B6B"
67+
BlueprintIdentifier = "16210A3B1D3EC474004AEDF3"
8368
BuildableName = "Bond.framework"
84-
BlueprintName = "Bond"
69+
BlueprintName = "Bond-iOS"
8570
ReferencedContainer = "container:Bond.xcodeproj">
8671
</BuildableReference>
8772
</MacroExpansion>
@@ -97,9 +82,9 @@
9782
<MacroExpansion>
9883
<BuildableReference
9984
BuildableIdentifier = "primary"
100-
BlueprintIdentifier = "69491BAD1A7C217100A13B6B"
85+
BlueprintIdentifier = "16210A3B1D3EC474004AEDF3"
10186
BuildableName = "Bond.framework"
102-
BlueprintName = "Bond"
87+
BlueprintName = "Bond-iOS"
10388
ReferencedContainer = "container:Bond.xcodeproj">
10489
</BuildableReference>
10590
</MacroExpansion>

Bond.xcodeproj/xcshareddata/xcschemes/BondtvOS.xcscheme renamed to Bond.xcodeproj/xcshareddata/xcschemes/Bond-macOS.xcscheme

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0710"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -14,9 +14,9 @@
1414
buildForAnalyzing = "YES">
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
17-
BlueprintIdentifier = "B56989C11BD8A00C00927A6B"
17+
BlueprintIdentifier = "16D30EAD1D6591D300C2435D"
1818
BuildableName = "Bond.framework"
19-
BlueprintName = "BondtvOS"
19+
BlueprintName = "Bond-macOS"
2020
ReferencedContainer = "container:Bond.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
@@ -26,8 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
shouldUseLaunchSchemeArgsEnv = "YES"
30-
codeCoverageEnabled = "YES">
29+
shouldUseLaunchSchemeArgsEnv = "YES">
3130
<Testables>
3231
</Testables>
3332
<AdditionalOptions>
@@ -46,9 +45,9 @@
4645
<MacroExpansion>
4746
<BuildableReference
4847
BuildableIdentifier = "primary"
49-
BlueprintIdentifier = "B56989C11BD8A00C00927A6B"
48+
BlueprintIdentifier = "16D30EAD1D6591D300C2435D"
5049
BuildableName = "Bond.framework"
51-
BlueprintName = "BondtvOS"
50+
BlueprintName = "Bond-macOS"
5251
ReferencedContainer = "container:Bond.xcodeproj">
5352
</BuildableReference>
5453
</MacroExpansion>
@@ -64,9 +63,9 @@
6463
<MacroExpansion>
6564
<BuildableReference
6665
BuildableIdentifier = "primary"
67-
BlueprintIdentifier = "B56989C11BD8A00C00927A6B"
66+
BlueprintIdentifier = "16D30EAD1D6591D300C2435D"
6867
BuildableName = "Bond.framework"
69-
BlueprintName = "BondtvOS"
68+
BlueprintName = "Bond-macOS"
7069
ReferencedContainer = "container:Bond.xcodeproj">
7170
</BuildableReference>
7271
</MacroExpansion>

Bond.xcodeproj/xcshareddata/xcschemes/BondOSX.xcscheme renamed to Bond.xcodeproj/xcshareddata/xcschemes/Bond-tvOS.xcscheme

+8-42
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -14,23 +14,9 @@
1414
buildForAnalyzing = "YES">
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
17-
BlueprintIdentifier = "DCA979681A83C3A100DD4A30"
17+
BlueprintIdentifier = "16D30ED51D65D11900C2435D"
1818
BuildableName = "Bond.framework"
19-
BlueprintName = "BondOSX"
20-
ReferencedContainer = "container:Bond.xcodeproj">
21-
</BuildableReference>
22-
</BuildActionEntry>
23-
<BuildActionEntry
24-
buildForTesting = "YES"
25-
buildForRunning = "NO"
26-
buildForProfiling = "NO"
27-
buildForArchiving = "NO"
28-
buildForAnalyzing = "NO">
29-
<BuildableReference
30-
BuildableIdentifier = "primary"
31-
BlueprintIdentifier = "DCA979721A83C3A200DD4A30"
32-
BuildableName = "BondOSXTests.xctest"
33-
BlueprintName = "BondOSXTests"
19+
BlueprintName = "Bond-tvOS"
3420
ReferencedContainer = "container:Bond.xcodeproj">
3521
</BuildableReference>
3622
</BuildActionEntry>
@@ -40,29 +26,9 @@
4026
buildConfiguration = "Debug"
4127
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4228
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43-
shouldUseLaunchSchemeArgsEnv = "YES"
44-
codeCoverageEnabled = "YES">
29+
shouldUseLaunchSchemeArgsEnv = "YES">
4530
<Testables>
46-
<TestableReference
47-
skipped = "NO">
48-
<BuildableReference
49-
BuildableIdentifier = "primary"
50-
BlueprintIdentifier = "DCA979721A83C3A200DD4A30"
51-
BuildableName = "BondOSXTests.xctest"
52-
BlueprintName = "BondOSXTests"
53-
ReferencedContainer = "container:Bond.xcodeproj">
54-
</BuildableReference>
55-
</TestableReference>
5631
</Testables>
57-
<MacroExpansion>
58-
<BuildableReference
59-
BuildableIdentifier = "primary"
60-
BlueprintIdentifier = "DCA979681A83C3A100DD4A30"
61-
BuildableName = "Bond.framework"
62-
BlueprintName = "BondOSX"
63-
ReferencedContainer = "container:Bond.xcodeproj">
64-
</BuildableReference>
65-
</MacroExpansion>
6632
<AdditionalOptions>
6733
</AdditionalOptions>
6834
</TestAction>
@@ -79,9 +45,9 @@
7945
<MacroExpansion>
8046
<BuildableReference
8147
BuildableIdentifier = "primary"
82-
BlueprintIdentifier = "DCA979681A83C3A100DD4A30"
48+
BlueprintIdentifier = "16D30ED51D65D11900C2435D"
8349
BuildableName = "Bond.framework"
84-
BlueprintName = "BondOSX"
50+
BlueprintName = "Bond-tvOS"
8551
ReferencedContainer = "container:Bond.xcodeproj">
8652
</BuildableReference>
8753
</MacroExpansion>
@@ -97,9 +63,9 @@
9763
<MacroExpansion>
9864
<BuildableReference
9965
BuildableIdentifier = "primary"
100-
BlueprintIdentifier = "DCA979681A83C3A100DD4A30"
66+
BlueprintIdentifier = "16D30ED51D65D11900C2435D"
10167
BuildableName = "Bond.framework"
102-
BlueprintName = "BondOSX"
68+
BlueprintName = "Bond-tvOS"
10369
ReferencedContainer = "container:Bond.xcodeproj">
10470
</BuildableReference>
10571
</MacroExpansion>

Bond/BNDProtocolProxyBase.h

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// RKDelegate.h
3+
// ReactiveKit
4+
//
5+
// Created by Srdan Rasic on 14/05/16.
6+
// Copyright © 2016 Srdan Rasic. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface RKProtocolProxyBase : NSObject
12+
13+
@property (nonatomic, readonly, nonnull, strong) Protocol *protocol;
14+
15+
/// An object conforming to protocol `protocol` to which forward methods calls.
16+
@property (nonatomic, nullable, weak) NSObject *forwardTo;
17+
18+
- (nonnull instancetype)initWithProtocol:(nonnull Protocol *)protocol;
19+
- (BOOL)hasHandlerForSelector:(nonnull SEL)selector;
20+
- (void)invokeWithSelector:(nonnull SEL)selector argumentExtractor:(void (^_Nonnull)(NSInteger index, void * _Nullable buffer))argumentExtractor setReturnValue:(void (^_Nullable)(void * _Nullable buffer))setReturnValue;
21+
22+
@end

Bond/BNDProtocolProxyBase.m

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
//
2+
// RKDelegate.m
3+
// ReactiveKit
4+
//
5+
// Created by Srdan Rasic on 14/05/16.
6+
// Copyright © 2016 Srdan Rasic. All rights reserved.
7+
//
8+
9+
#import "BNDProtocolProxyBase.h"
10+
#import <objc/runtime.h>
11+
12+
@interface RKProtocolProxyBase ()
13+
@property (nonatomic, readwrite, strong) Protocol *protocol;
14+
@end
15+
16+
@implementation RKProtocolProxyBase
17+
18+
- (instancetype)initWithProtocol:(Protocol *)protocol
19+
{
20+
self = [super init];
21+
if (self) {
22+
_protocol = protocol;
23+
}
24+
return self;
25+
}
26+
27+
- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector
28+
{
29+
NSMethodSignature *signature = [super methodSignatureForSelector:selector];
30+
31+
if (!signature && [self hasHandlerForSelector:selector]) {
32+
struct objc_method_description description = protocol_getMethodDescription(self.protocol, selector, NO, YES);
33+
if (description.types == NULL) {
34+
description = protocol_getMethodDescription(self.protocol, selector, YES, YES);
35+
}
36+
signature = [NSMethodSignature signatureWithObjCTypes:description.types];
37+
}
38+
39+
if (!signature) {
40+
signature = [self.forwardTo methodSignatureForSelector:selector];
41+
}
42+
43+
return signature;
44+
}
45+
46+
- (BOOL)hasHandlerForSelector:(SEL)selector
47+
{
48+
return NO;
49+
}
50+
51+
- (void)invokeWithSelector:(SEL)selector argumentExtractor:(void (^)(NSInteger index, void *buffer))argumentExtractor setReturnValue:(void (^)(void *buffer))setReturnValue
52+
{
53+
}
54+
55+
- (void)forwardInvocation:(NSInvocation *)invocation
56+
{
57+
if ([self hasHandlerForSelector:invocation.selector]) {
58+
if (invocation.methodSignature.methodReturnLength > 0) {
59+
[invocation retainArguments];
60+
[self invokeWithSelector:invocation.selector argumentExtractor:^(NSInteger index, void *buffer) {
61+
[invocation getArgument:buffer atIndex:index];
62+
} setReturnValue:^(void *buffer) {
63+
[invocation setReturnValue:buffer];
64+
}];
65+
} else {
66+
[self invokeWithSelector:invocation.selector argumentExtractor:^(NSInteger index, void *buffer) {
67+
[invocation getArgument:buffer atIndex:index];
68+
} setReturnValue:nil];
69+
}
70+
71+
if ([self.forwardTo respondsToSelector:invocation.selector]) {
72+
[invocation invokeWithTarget:self.forwardTo];
73+
}
74+
} else {
75+
if ([self.forwardTo respondsToSelector:invocation.selector]) {
76+
[invocation invokeWithTarget:self.forwardTo];
77+
} else {
78+
[super forwardInvocation:invocation];
79+
}
80+
}
81+
}
82+
83+
@end

0 commit comments

Comments
 (0)