Skip to content

Commit 15a9ac0

Browse files
committed
Merge remote-tracking branch 'upstream/master' into UIFeedbackGenerator
2 parents 1474602 + ae6ebb7 commit 15a9ac0

9 files changed

+56
-46
lines changed

.swift-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ matrix:
2525
env:
2626
- XCODE_SDK=iphonesimulator
2727
- XCODE_ACTION="build-for-testing test-without-building"
28-
- XCODE_DESTINATION="platform=iOS Simulator,id=31E6604A-19AA-4B68-B560-C33C584BC80D" # iPhone 6s, iOS 10.2
29-
# - XCODE_DESTINATION="platform=iOS Simulator,name=iPhone 6s,OS=10.2"
28+
- XCODE_DESTINATION="platform=iOS Simulator,name=iPhone 6s,OS=10.2"
3029
# - XCODE_PLAYGROUND_TARGET="x86_64-apple-ios9.3"
3130
# - PLAYGROUND="ReactiveCocoa-iOS.playground"
3231
- xcode_scheme: ReactiveCocoa-tvOS
@@ -40,7 +39,7 @@ matrix:
4039
env:
4140
- XCODE_SDK=watchsimulator
4241
- XCODE_ACTION=build
43-
- XCODE_DESTINATION="platform=watchOS Simulator,name=Apple Watch - 38mm"
42+
- XCODE_DESTINATION="platform=watchOS Simulator,name=Apple Watch - 38mm,OS=2.2"
4443
- script:
4544
- carthage build --no-skip-current --platform mac
4645
env:

ReactiveCocoa.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@
257257
CD0C45DF1CC9A288009F5BF0 /* DynamicProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD0C45DD1CC9A288009F5BF0 /* DynamicProperty.swift */; };
258258
CD0C45E01CC9A288009F5BF0 /* DynamicProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD0C45DD1CC9A288009F5BF0 /* DynamicProperty.swift */; };
259259
CD0C45E11CC9A288009F5BF0 /* DynamicProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD0C45DD1CC9A288009F5BF0 /* DynamicProperty.swift */; };
260+
CD42C69B1E951F6900AA9504 /* ReactiveCocoaTestsConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD42C69A1E951F6900AA9504 /* ReactiveCocoaTestsConfiguration.swift */; };
261+
CD42C69C1E951F6A00AA9504 /* ReactiveCocoaTestsConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD42C69A1E951F6900AA9504 /* ReactiveCocoaTestsConfiguration.swift */; };
262+
CD42C69D1E951F6A00AA9504 /* ReactiveCocoaTestsConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD42C69A1E951F6900AA9504 /* ReactiveCocoaTestsConfiguration.swift */; };
260263
CD8401831CEE8ED7009F0ABF /* CocoaActionSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD8401821CEE8ED7009F0ABF /* CocoaActionSpec.swift */; };
261264
CD8401841CEE8ED7009F0ABF /* CocoaActionSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD8401821CEE8ED7009F0ABF /* CocoaActionSpec.swift */; };
262265
CD8401851CEE8ED7009F0ABF /* CocoaActionSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD8401821CEE8ED7009F0ABF /* CocoaActionSpec.swift */; };
@@ -468,6 +471,7 @@
468471
BFCF77601DFAD9120058006E /* UISearchBarSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UISearchBarSpec.swift; sourceTree = "<group>"; };
469472
BFE145881E43991A00208736 /* UIPickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIPickerView.swift; sourceTree = "<group>"; };
470473
CD0C45DD1CC9A288009F5BF0 /* DynamicProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DynamicProperty.swift; sourceTree = "<group>"; };
474+
CD42C69A1E951F6900AA9504 /* ReactiveCocoaTestsConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReactiveCocoaTestsConfiguration.swift; sourceTree = "<group>"; };
471475
CD8401821CEE8ED7009F0ABF /* CocoaActionSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CocoaActionSpec.swift; sourceTree = "<group>"; };
472476
CDC42E2E1AE7AB8B00965373 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; };
473477
D03766B119EDA60000A782A9 /* test-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "test-data.json"; sourceTree = "<group>"; };
@@ -828,6 +832,7 @@
828832
9ADFE5A01DBFFBCF001E11F7 /* LifetimeSpec.swift */,
829833
9A24A8431DE1429600987AF9 /* SwizzlingSpec.swift */,
830834
3B30EE8B1E7BE529007CC8EF /* DeprecationsSpec.swift */,
835+
CD42C69A1E951F6900AA9504 /* ReactiveCocoaTestsConfiguration.swift */,
831836
D04725FA19E49ED7006002AA /* Supporting Files */,
832837
);
833838
path = ReactiveCocoaTests;
@@ -1265,6 +1270,7 @@
12651270
9A1D063B1D93EA7E00ACF44C /* UIButtonSpec.swift in Sources */,
12661271
9A24A8471DE142A600987AF9 /* SwizzlingSpec.swift in Sources */,
12671272
9A1D064B1D93EA7E00ACF44C /* UISegmentedControlSpec.swift in Sources */,
1273+
CD42C69D1E951F6A00AA9504 /* ReactiveCocoaTestsConfiguration.swift in Sources */,
12681274
9A1D063F1D93EA7E00ACF44C /* UIControl+EnableSendActionsForControlEvents.swift in Sources */,
12691275
9A1D06371D93EA7E00ACF44C /* UIActivityIndicatorViewSpec.swift in Sources */,
12701276
9A6AAA2F1DB903A40013AAEA /* ReusableComponentsSpec.swift in Sources */,
@@ -1374,6 +1380,7 @@
13741380
CD8401831CEE8ED7009F0ABF /* CocoaActionSpec.swift in Sources */,
13751381
9A9DFEE91DA7EFB60039EE1B /* AssociationSpec.swift in Sources */,
13761382
3B30EE8C1E7BE529007CC8EF /* DeprecationsSpec.swift in Sources */,
1383+
CD42C69B1E951F6900AA9504 /* ReactiveCocoaTestsConfiguration.swift in Sources */,
13771384
9A1E72BA1D4DE96500CC20C3 /* KeyValueObservingSpec.swift in Sources */,
13781385
4ABEFE2E1DCFD01F0066A8C2 /* NSTableViewSpec.swift in Sources */,
13791386
);
@@ -1462,6 +1469,7 @@
14621469
9A892D901E8D19BE00EA35F3 /* DelegateProxySpec.swift in Sources */,
14631470
531866FA1DD7925600D1285F /* UIStepperSpec.swift in Sources */,
14641471
9A1D06361D93EA7E00ACF44C /* UIActivityIndicatorViewSpec.swift in Sources */,
1472+
CD42C69C1E951F6A00AA9504 /* ReactiveCocoaTestsConfiguration.swift in Sources */,
14651473
9A1D06461D93EA7E00ACF44C /* UILabelSpec.swift in Sources */,
14661474
3B30EE8D1E7BE529007CC8EF /* DeprecationsSpec.swift in Sources */,
14671475
9A9DFEEA1DA7EFB60039EE1B /* AssociationSpec.swift in Sources */,

ReactiveCocoa/NSObject+KeyValueObserving.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ internal struct PropertyAttributes {
264264
let _next = NSGetSizeAndAlignment(typeString, nil, nil)
265265
guard _next != typeString else {
266266
let string = String(validatingUTF8: attrString)
267-
preconditionFailure("Could not read past type in attribute string: \(string).")
267+
preconditionFailure("Could not read past type in attribute string: \(String(describing: string)).")
268268
}
269269
var next = UnsafeMutablePointer<Int8>(mutating: _next)
270270

@@ -355,7 +355,7 @@ internal struct PropertyAttributes {
355355

356356
case Code.Attribute.oldTypeEncoding:
357357
let string = String(validatingUTF8: attrString)
358-
assertionFailure("Old-style type encoding is unsupported in attribute string \"\(string)\"")
358+
assertionFailure("Old-style type encoding is unsupported in attribute string \"\(String(describing: string))\"")
359359

360360
// skip over this type encoding
361361
while next.pointee != Code.comma && next.pointee != Code.nul {
@@ -369,14 +369,14 @@ internal struct PropertyAttributes {
369369

370370
let flag = String(validatingUTF8: pointer)
371371
let string = String(validatingUTF8: attrString)
372-
preconditionFailure("ERROR: Unrecognized attribute string flag '\(flag)' in attribute string \"\(string)\".")
372+
preconditionFailure("ERROR: Unrecognized attribute string flag '\(String(describing: flag))' in attribute string \"\(String(describing: string))\".")
373373
}
374374
}
375375

376376
if next.pointee != Code.nul {
377377
let unparsedData = String(validatingUTF8: next)
378378
let string = String(validatingUTF8: attrString)
379-
assertionFailure("Warning: Unparsed data \"\(unparsedData)\" in attribute string \"\(string)\".")
379+
assertionFailure("Warning: Unparsed data \"\(String(describing: unparsedData))\" in attribute string \"\(String(describing: string))\".")
380380
}
381381

382382
self.objectClass = objectClass

ReactiveCocoaTests/InterceptingSpec.swift

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import CoreGraphics
88

99
class InterceptingSpec: QuickSpec {
1010
override func spec() {
11+
beforeSuite {
12+
ForwardInvocationTestObject._initialize()
13+
}
14+
1115
describe("trigger(for:)") {
1216
var object: InterceptedObject!
1317
weak var _object: InterceptedObject?
@@ -830,36 +834,28 @@ private class ForwardInvocationTestObject: InterceptedObject {
830834
var forwardedCount = 0
831835
var forwardedSelector: Selector?
832836

833-
override open class func initialize() {
834-
struct Static {
835-
static var token: Int = {
836-
let impl: @convention(c) (Any, Selector, AnyObject) -> Void = { object, _, invocation in
837-
let object = object as! ForwardInvocationTestObject
838-
object.forwardedCount += 1
839-
object.forwardedSelector = invocation.selector
840-
}
841-
842-
let success = class_addMethod(ForwardInvocationTestObject.self,
843-
ObjCSelector.forwardInvocation,
844-
unsafeBitCast(impl, to: IMP.self),
845-
ObjCMethodEncoding.forwardInvocation)
846-
847-
assert(success)
848-
assert(ForwardInvocationTestObject.instancesRespond(to: ObjCSelector.forwardInvocation))
837+
fileprivate static func _initialize() {
838+
let impl: @convention(c) (Any, Selector, AnyObject) -> Void = { object, _, invocation in
839+
let object = object as! ForwardInvocationTestObject
840+
object.forwardedCount += 1
841+
object.forwardedSelector = invocation.selector
842+
}
849843

850-
let success2 = class_addMethod(ForwardInvocationTestObject.self,
851-
ForwardInvocationTestObject.forwardedSelector,
852-
_rac_objc_msgForward,
853-
ObjCMethodEncoding.forwardInvocation)
844+
let success = class_addMethod(ForwardInvocationTestObject.self,
845+
ObjCSelector.forwardInvocation,
846+
unsafeBitCast(impl, to: IMP.self),
847+
ObjCMethodEncoding.forwardInvocation)
854848

855-
assert(success2)
856-
assert(ForwardInvocationTestObject.instancesRespond(to: ForwardInvocationTestObject.forwardedSelector))
849+
assert(success)
850+
assert(ForwardInvocationTestObject.instancesRespond(to: ObjCSelector.forwardInvocation))
857851

858-
return 0
859-
}()
860-
}
852+
let success2 = class_addMethod(ForwardInvocationTestObject.self,
853+
ForwardInvocationTestObject.forwardedSelector,
854+
_rac_objc_msgForward,
855+
ObjCMethodEncoding.forwardInvocation)
861856

862-
_ = Static.token
857+
assert(success2)
858+
assert(ForwardInvocationTestObject.instancesRespond(to: ForwardInvocationTestObject.forwardedSelector))
863859
}
864860
}
865861

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Quick
2+
#if os(iOS) || os(tvOS)
3+
import UIKit
4+
#endif
5+
6+
class ReactiveCocoaTestsConfiguration: QuickConfiguration {
7+
override class func configure(_ configuration: Configuration) {
8+
#if os(iOS) || os(tvOS)
9+
configuration.beforeSuite {
10+
UIControl._initialize()
11+
}
12+
#endif
13+
}
14+
}

ReactiveCocoaTests/SignalProducerNimbleMatchers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public func sendValues<T: Equatable, E: Equatable>(_ values: [T], sendError mayb
1111
return NonNilMatcherFunc { actualExpression, failureMessage in
1212
precondition(maybeSendError == nil || !complete, "Signals can't both send an error and complete")
1313

14-
failureMessage.postfixMessage = "Send values \(values). Send error \(maybeSendError). Complete: \(complete)"
14+
failureMessage.postfixMessage = "Send values \(values). Send error \(String(describing: maybeSendError)). Complete: \(complete)"
1515
let maybeProducer = try actualExpression.evaluate()
1616

1717
if let signalProducer = maybeProducer {

ReactiveCocoaTests/UIKit/UIControl+EnableSendActionsForControlEvents.swift

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import UIKit
22

3-
private let rac_swizzleToken: Void = {
3+
private func rac_swizzle() {
44
let originalSelector = #selector(UIControl.sendAction(_:to:for:))
55
let swizzledSelector = #selector(UIControl.rac_sendAction(_:to:forEvent:))
66

@@ -20,22 +20,16 @@ private let rac_swizzleToken: Void = {
2020
} else {
2121
method_exchangeImplementations(originalMethod, swizzledMethod)
2222
}
23-
24-
return ()
25-
}()
23+
}
2624

2725
/// Unfortunately, there's an apparent limitation in using `sendActionsForControlEvents`
2826
/// on unit-tests for any control besides `UIButton` which is very unfortunate since we
2927
/// want test our bindings for `UIDatePicker`, `UISwitch`, `UITextField` and others
3028
/// in the future. To be able to test them, we're now using swizzling to manually invoke
3129
/// the pair target+action.
3230
extension UIControl {
33-
override open class func initialize() {
34-
guard self === UIControl.self else {
35-
return
36-
}
37-
38-
_ = rac_swizzleToken
31+
static func _initialize() {
32+
rac_swizzle()
3933
}
4034

4135
// MARK: - Method Swizzling

ReactiveCocoaTests/UIKit/UIDatePickerSpec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class UIDatePickerSpec: QuickSpec {
2525
}
2626

2727
it("should accept changes from bindings to its date value") {
28-
picker.reactive.date.consume(date)
28+
picker.reactive.date.action(date)
2929
expect(picker.date) == date
3030
}
3131

0 commit comments

Comments
 (0)