Skip to content

Commit

Permalink
Merge branch 'swift3' of https://github.com/liscio/ReactiveCocoa into…
Browse files Browse the repository at this point in the history
… liscio-swift3
  • Loading branch information
liscio committed Jun 24, 2016
2 parents 521a731 + 21ec54e commit 168b679
Show file tree
Hide file tree
Showing 27 changed files with 491 additions and 449 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "Carthage/Checkouts/Nimble"]
path = Carthage/Checkouts/Nimble
url = https://github.com/norio-nomura/Nimble.git
url = https://github.com/liscio/Nimble.git
[submodule "Carthage/Checkouts/Quick"]
path = Carthage/Checkouts/Quick
url = https://github.com/sharplet/Quick.git
url = https://github.com/liscio/Quick.git
[submodule "Carthage/Checkouts/xcconfigs"]
path = Carthage/Checkouts/xcconfigs
url = https://github.com/jspahrsummers/xcconfigs.git
Expand Down
4 changes: 2 additions & 2 deletions Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "jspahrsummers/xcconfigs" ~> 0.9
github "andersio/Quick" "nn-swift-3-compatibility"
github "norio-nomura/Nimble" "nn-swift-3-compatibility"
github "liscio/Quick" "cl-swift-3-compatibility"
github "liscio/Nimble" "cl-swift3-compatibility"
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "norio-nomura/Nimble" "770c11a29e06caec38cc85dba69e94ee50bd9a3a"
github "andersio/Quick" "5829388e4dc732306db0794569b3a2cf29cb1297"
github "liscio/Nimble" "7c39fc491f86027bfb159cd21d3cffe9de9cb033"
github "liscio/Quick" "83eb4897ebae25093a0c39a775424de0d797bd2f"
github "liscio/Result" "e96316e6afabd5e1f1389571babc3cfee5edb5b9"
github "jspahrsummers/xcconfigs" "0.9"
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ scopedExample("`buffer`") {

producer.start { event in
switch event {
case let .Next(value):
case let .next(value):
values.append(value)
default:
break
Expand Down
2 changes: 1 addition & 1 deletion ReactiveCocoa.playground/Sources/PlaygroundUtility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ public func scopedExample(exampleDescription: String, _ action: () -> Void) {
action()
}

public enum Error: ErrorType {
public enum Error: ErrorProtocol {
case Example(String)
}
8 changes: 8 additions & 0 deletions ReactiveCocoa.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3131,6 +3131,7 @@
baseConfigurationReference = D047262919E49FE8006002AA /* Debug.xcconfig */;
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -3151,6 +3152,7 @@
baseConfigurationReference = D047262B19E49FE8006002AA /* Release.xcconfig */;
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = YES;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -3204,6 +3206,7 @@
);
INFOPLIST_FILE = ReactiveCocoaTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = "$(PROJECT_NAME)Tests";
};
name = Debug;
Expand All @@ -3219,6 +3222,7 @@
);
INFOPLIST_FILE = ReactiveCocoaTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = "$(PROJECT_NAME)Tests";
};
name = Release;
Expand Down Expand Up @@ -3288,6 +3292,7 @@
baseConfigurationReference = D047262A19E49FE8006002AA /* Profile.xcconfig */;
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
Expand Down Expand Up @@ -3326,6 +3331,7 @@
);
INFOPLIST_FILE = ReactiveCocoaTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = "$(PROJECT_NAME)Tests";
};
name = Profile;
Expand Down Expand Up @@ -3365,6 +3371,7 @@
baseConfigurationReference = D047262C19E49FE8006002AA /* Test.xcconfig */;
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
Expand Down Expand Up @@ -3403,6 +3410,7 @@
);
INFOPLIST_FILE = ReactiveCocoaTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = "$(PROJECT_NAME)Tests";
};
name = Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
enableThreadSanitizer = "YES"
stopOnEveryThreadSanitizerIssue = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
enableAddressSanitizer = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down
2 changes: 1 addition & 1 deletion ReactiveCocoa/Swift/Atomic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public final class Atomic<Value> {
///
/// Returns the old value.
@discardableResult
public func modify(action: @noescape (inout Value) throws -> Void) rethrows -> Value {
public func modify(_ action: @noescape (inout Value) throws -> Void) rethrows -> Value {
return try withValue { value in
try action(&_value)
return value
Expand Down
2 changes: 1 addition & 1 deletion ReactiveCocoa/Swift/FoundationExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension NotificationCenter {
/// terminate immediatelly with an Interrupted event. Otherwise, the producer
/// will not terminate naturally, so it must be explicitly disposed to avoid
/// leaks.
public func rac_notifications(_ name: Notification.Name, object: AnyObject? = nil) -> SignalProducer<Notification, NoError> {
public func rac_notifications(for name: Notification.Name, object: AnyObject? = nil) -> SignalProducer<Notification, NoError> {
// We're weakly capturing an optional reference here, which makes destructuring awkward.
let objectWasNil = (object == nil)
return SignalProducer { [weak object] observer, disposable in
Expand Down
2 changes: 1 addition & 1 deletion ReactiveCocoa/Swift/Property.swift
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ public final class MutableProperty<Value>: MutablePropertyType {
///
/// Returns the old value.
@discardableResult
public func modify(action: @noescape (inout Value) throws -> Void) rethrows -> Value {
public func modify(_ action: @noescape (inout Value) throws -> Void) rethrows -> Value {
return try withValue { value in
try action(&box.value)
observer.sendNext(box.value)
Expand Down
12 changes: 10 additions & 2 deletions ReactiveCocoa/Swift/SignalProducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public struct SignalProducer<Value, Error: ErrorProtocol> {
/// Upon success, the started signal will send the resulting value then
/// complete. Upon failure, the started signal will fail with the error that
/// occurred.
public static func attempt(operation: () -> Result<Value, Error>) -> SignalProducer {
public static func attempt(_ operation: () -> Result<Value, Error>) -> SignalProducer {
return self.init { observer, disposable in
operation().analysis(ifSuccess: { value in
observer.sendNext(value)
Expand Down Expand Up @@ -531,7 +531,7 @@ extension SignalProducerProtocol {
/// array may not have `count` values. Alternatively, if were not collected
/// any values will sent an empty array of values.
///
public func collect(_ count: Int) -> SignalProducer<[Value], Error> {
public func collect(count: Int) -> SignalProducer<[Value], Error> {
precondition(count > 0)
return lift { $0.collect(count: count) }
}
Expand Down Expand Up @@ -1099,7 +1099,11 @@ public func combineLatest<A, B, C, D, E, F, G, H, I, J, Error>(_ a: SignalProduc

/// Combines the values of all the given producers, in the manner described by
/// `combineLatestWith`. Will return an empty `SignalProducer` if the sequence is empty.
<<<<<<< HEAD
public func combineLatest<S: Sequence, Value, Error where S.Iterator.Element == SignalProducer<Value, Error>>(producers: S) -> SignalProducer<[Value], Error> {
=======
public func combineLatest<S: Sequence, Value, Error where S.Iterator.Element == SignalProducer<Value, Error>>(_ producers: S) -> SignalProducer<[Value], Error> {
>>>>>>> 21ec54ef51fad0152c459503dfcac74d704d7a25
var generator = producers.makeIterator()
if let first = generator.next() {
let initial = first.map { [$0] }
Expand Down Expand Up @@ -1183,7 +1187,11 @@ public func zip<A, B, C, D, E, F, G, H, I, J, Error>(_ a: SignalProducer<A, Erro

/// Zips the values of all the given producers, in the manner described by
/// `zipWith`. Will return an empty `SignalProducer` if the sequence is empty.
<<<<<<< HEAD
public func zip<S: Sequence, Value, Error where S.Iterator.Element == SignalProducer<Value, Error>>(producers: S) -> SignalProducer<[Value], Error> {
=======
public func zip<S: Sequence, Value, Error where S.Iterator.Element == SignalProducer<Value, Error>>(_ producers: S) -> SignalProducer<[Value], Error> {
>>>>>>> 21ec54ef51fad0152c459503dfcac74d704d7a25
var generator = producers.makeIterator()
if let first = generator.next() {
let initial = first.map { [$0] }
Expand Down
20 changes: 19 additions & 1 deletion ReactiveCocoaTests/Objective-C/RACKVOProxySpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
//

#import <pthread/pthread.h>
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>

Expand All @@ -20,6 +21,7 @@

@interface TestObject : NSObject {
volatile int _testInt;
pthread_mutex_t _mutex;
}

@property (assign, atomic) int testInt;
Expand All @@ -28,15 +30,31 @@ @interface TestObject : NSObject {

@implementation TestObject

- (instancetype)init {
if ( !(self = [super init]) ) {
return nil;
}

pthread_mutex_init(&_mutex, nil);

return self;
}

- (int)testInt {
return _testInt;
int test = 0;
pthread_mutex_lock(&_mutex);
test = _testInt;
pthread_mutex_unlock(&_mutex);
return test;
}

// Use manual KVO notifications to avoid any possible race conditions within the
// automatic KVO implementation.
- (void)setTestInt:(int)value {
[self willChangeValueForKey:@keypath(self.testInt)];
pthread_mutex_lock(&_mutex);
_testInt = value;
pthread_mutex_unlock(&_mutex);
[self didChangeValueForKey:@keypath(self.testInt)];
}

Expand Down
4 changes: 2 additions & 2 deletions ReactiveCocoaTests/Swift/ActionSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ActionSpec: QuickSpec {

expect(receivedError).notTo(beNil())
if let error = receivedError {
let expectedError = ActionError<NSError>.NotEnabled
let expectedError = ActionError<NSError>.notEnabled
expect(error == expectedError) == true
}
}
Expand Down Expand Up @@ -127,7 +127,7 @@ class ActionSpec: QuickSpec {

expect(receivedError).notTo(beNil())
if let error = receivedError {
let expectedError = ActionError<NSError>.ProducerError(testError)
let expectedError = ActionError<NSError>.producerError(testError)
expect(error == expectedError) == true
}

Expand Down
10 changes: 5 additions & 5 deletions ReactiveCocoaTests/Swift/CocoaActionSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class CocoaActionSpec: QuickSpec {
}
#elseif os(iOS)
it("should be compatible with UIKit") {
let control = UIControl(frame: CGRectZero)
control.addTarget(action.unsafeCocoaAction, action: CocoaAction.selector, forControlEvents: UIControlEvents.TouchDown)
control.sendActionsForControlEvents(UIControlEvents.TouchDown)
let control = UIControl(frame: .zero)
control.addTarget(action.unsafeCocoaAction, action: CocoaAction.selector, for: .touchDown)
control.sendActions(for: .touchDown)
}
#endif

Expand All @@ -34,7 +34,7 @@ class CocoaActionSpec: QuickSpec {

let cocoaAction = action.unsafeCocoaAction
cocoaAction
.rac_valuesForKeyPath("enabled", observer: nil)
.rac_values(forKeyPath: "enabled", observer: nil)
.toSignalProducer()
.map { $0! as! Bool }
.start(Observer(next: { values.append($0) }))
Expand All @@ -53,7 +53,7 @@ class CocoaActionSpec: QuickSpec {

let cocoaAction = action.unsafeCocoaAction
cocoaAction
.rac_valuesForKeyPath("executing", observer: nil)
.rac_values(forKeyPath: "executing", observer: nil)
.toSignalProducer()
.map { $0! as! Bool }
.start(Observer(next: { values.append($0) }))
Expand Down
Loading

0 comments on commit 168b679

Please sign in to comment.