From 5a0a13a7ea26e644315bc24cc454e80e241d97e3 Mon Sep 17 00:00:00 2001 From: Markus Chmelar Date: Mon, 31 Oct 2016 00:21:05 +0100 Subject: [PATCH 1/4] Update to Swift 3.0 and RAC 5.0, remove UI Extensions --- Cartfile | 2 +- Cartfile.resolved | 5 +- Rex.xcodeproj/project.pbxproj | 197 +++++++----------- .../xcshareddata/xcschemes/Rex-Mac.xcscheme | 2 +- .../xcshareddata/xcschemes/Rex-iOS.xcscheme | 2 +- .../xcshareddata/xcschemes/Rex-tvOS.xcscheme | 2 +- .../xcschemes/Rex-watchOS.xcscheme | 2 +- Source/Action.swift | 19 +- Source/AppKit/NSTextField.swift | 22 -- Source/Deprecations+Removals.swift | 136 ++++++++++++ Source/Foundation/Association.swift | 29 +-- Source/Foundation/NSData.swift | 13 +- Source/Foundation/NSObject.swift | 37 ---- Source/Foundation/NSUserDefaults.swift | 21 +- Source/Property.swift | 88 ++++---- Source/RACSignal.swift | 58 +++--- Source/Reusable.swift | 46 ---- Source/Signal.swift | 70 +++---- Source/SignalProducer.swift | 66 +++--- Source/UIKit/UIActivityIndicatorView.swift | 29 --- Source/UIKit/UIBarButtonItem.swift | 35 ---- Source/UIKit/UIBarItem.swift | 19 -- Source/UIKit/UIButton.swift | 43 ---- Source/UIKit/UICollectionReusableView.swift | 11 - Source/UIKit/UIControl.swift | 35 +--- Source/UIKit/UIDatePicker.swift | 18 -- Source/UIKit/UIImageView.swift | 25 --- Source/UIKit/UILabel.swift | 31 --- Source/UIKit/UIProgressView.swift | 19 -- Source/UIKit/UISegmentedControl.swift | 22 -- Source/UIKit/UISwitch.swift | 18 -- Source/UIKit/UITableViewCell.swift | 13 -- .../UIKit/UITableViewHeaderFooterView.swift | 11 - Source/UIKit/UITextField.swift | 32 --- Source/UIKit/UITextView.swift | 21 -- Source/UIKit/UIView.swift | 32 --- Source/UIKit/UIViewController.swift | 29 +-- Tests/ActionTests.swift | 22 +- Tests/Foundation/NSObjectTests.swift | 25 ++- ...ol+EnableSendActionsForControlEvents.swift | 68 +++--- Tests/PropertyTests.swift | 20 +- Tests/SignalProducerTests.swift | 43 ++-- Tests/SignalTests.swift | 67 +++--- .../UIKit/UIActivityIndicatorViewTests.swift | 14 +- Tests/UIKit/UIBarButtonItemTests.swift | 15 +- Tests/UIKit/UIButtonTests.swift | 74 ++++--- .../UIKit/UICollectionReusableViewTests.swift | 12 +- Tests/UIKit/UIControlTests.swift | 92 ++++---- Tests/UIKit/UIDatePickerTests.swift | 29 +-- Tests/UIKit/UIImageViewTests.swift | 26 +-- Tests/UIKit/UILabelTests.swift | 42 ++-- Tests/UIKit/UIProgressViewTests.swift | 14 +- Tests/UIKit/UISegmentedControlTests.swift | 8 +- Tests/UIKit/UISwitchTests.swift | 24 ++- Tests/UIKit/UITableViewCellTests.swift | 6 +- .../UITableViewHeaderFooterViewTests.swift | 12 +- Tests/UIKit/UITextFieldTests.swift | 14 +- Tests/UIKit/UITextViewTests.swift | 12 +- Tests/UIKit/UIViewControllerTests.swift | 40 ++-- Tests/UIKit/UIViewTests.swift | 48 ++--- 60 files changed, 781 insertions(+), 1206 deletions(-) delete mode 100644 Source/AppKit/NSTextField.swift create mode 100644 Source/Deprecations+Removals.swift delete mode 100644 Source/Foundation/NSObject.swift delete mode 100644 Source/Reusable.swift delete mode 100644 Source/UIKit/UIActivityIndicatorView.swift delete mode 100644 Source/UIKit/UIBarButtonItem.swift delete mode 100644 Source/UIKit/UIBarItem.swift delete mode 100644 Source/UIKit/UIButton.swift delete mode 100644 Source/UIKit/UICollectionReusableView.swift delete mode 100644 Source/UIKit/UIDatePicker.swift delete mode 100644 Source/UIKit/UIImageView.swift delete mode 100644 Source/UIKit/UILabel.swift delete mode 100644 Source/UIKit/UIProgressView.swift delete mode 100644 Source/UIKit/UISegmentedControl.swift delete mode 100644 Source/UIKit/UISwitch.swift delete mode 100644 Source/UIKit/UITableViewCell.swift delete mode 100644 Source/UIKit/UITableViewHeaderFooterView.swift delete mode 100644 Source/UIKit/UITextField.swift delete mode 100644 Source/UIKit/UITextView.swift delete mode 100644 Source/UIKit/UIView.swift diff --git a/Cartfile b/Cartfile index c46e125..cf96789 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "ReactiveCocoa/ReactiveCocoa" ~> 4.2.2 +github "ReactiveCocoa/ReactiveCocoa" "5.0.0-alpha.3" diff --git a/Cartfile.resolved b/Cartfile.resolved index 7267e9d..9f809b4 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,3 @@ -github "antitypical/Result" "2.1.3" -github "ReactiveCocoa/ReactiveCocoa" "v4.2.2" +github "antitypical/Result" "3.0.0" +github "ReactiveCocoa/ReactiveSwift" "1.0.0-alpha.3" +github "ReactiveCocoa/ReactiveCocoa" "5.0.0-alpha.3" diff --git a/Rex.xcodeproj/project.pbxproj b/Rex.xcodeproj/project.pbxproj index ed0a7f5..c92f7ec 100644 --- a/Rex.xcodeproj/project.pbxproj +++ b/Rex.xcodeproj/project.pbxproj @@ -7,50 +7,45 @@ objects = { /* Begin PBXBuildFile section */ - 4238D5961B4D5950008534C0 /* NSTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4238D5951B4D5950008534C0 /* NSTextField.swift */; }; + 216B3F341DC6AFAC00E1DFAC /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 216B3F321DC6AFAC00E1DFAC /* ReactiveSwift.framework */; }; + 216B3F361DC6AFDD00E1DFAC /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 216B3F351DC6AFDD00E1DFAC /* ReactiveSwift.framework */; }; + 216B3F371DC6AFDD00E1DFAC /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 216B3F351DC6AFDD00E1DFAC /* ReactiveSwift.framework */; }; + 216B3F391DC6AFEC00E1DFAC /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 216B3F381DC6AFEC00E1DFAC /* ReactiveSwift.framework */; }; + 216B3F3A1DC6AFEC00E1DFAC /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 216B3F381DC6AFEC00E1DFAC /* ReactiveSwift.framework */; }; + 216B3F3C1DC6AFF800E1DFAC /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 216B3F3B1DC6AFF800E1DFAC /* ReactiveSwift.framework */; }; + 216B3F3D1DC6AFF800E1DFAC /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 216B3F3B1DC6AFF800E1DFAC /* ReactiveSwift.framework */; }; + 216B3F3E1DC6B03500E1DFAC /* ReactiveSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 216B3F381DC6AFEC00E1DFAC /* ReactiveSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 216B3F3F1DC6B04A00E1DFAC /* ReactiveSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 216B3F3B1DC6AFF800E1DFAC /* ReactiveSwift.framework */; }; + 216B3F401DC6B06E00E1DFAC /* ReactiveSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 216B3F351DC6AFDD00E1DFAC /* ReactiveSwift.framework */; }; + 21A374871DC68E8D00521C86 /* Deprecations+Removals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A374861DC68E8D00521C86 /* Deprecations+Removals.swift */; }; + 21A374881DC69D0800521C86 /* Deprecations+Removals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A374861DC68E8D00521C86 /* Deprecations+Removals.swift */; }; + 21A374891DC69D0900521C86 /* Deprecations+Removals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A374861DC68E8D00521C86 /* Deprecations+Removals.swift */; }; + 21A3748A1DC69D0900521C86 /* Deprecations+Removals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A374861DC68E8D00521C86 /* Deprecations+Removals.swift */; }; 45CED46F1D27C1E300788BDC /* UIActivityIndicatorViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CED46D1D27C1D400788BDC /* UIActivityIndicatorViewTests.swift */; }; 45CED4701D27C1E400788BDC /* UIActivityIndicatorViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CED46D1D27C1D400788BDC /* UIActivityIndicatorViewTests.swift */; }; - 45CED4711D27C1EB00788BDC /* UIActivityIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CED46B1D27BB8700788BDC /* UIActivityIndicatorView.swift */; }; - 45CED4721D27C1EC00788BDC /* UIActivityIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CED46B1D27BB8700788BDC /* UIActivityIndicatorView.swift */; }; 4A8EDADB1D54D12400A1734C /* UIControl+EnableSendActionsForControlEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D0DABA91CCC381F00B6CD2B /* UIControl+EnableSendActionsForControlEvents.swift */; }; - 5B7F81E31D0842AD0014B06D /* UISegmentedControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1C882D1D0715CE000B888F /* UISegmentedControl.swift */; }; 5B7F81E41D0842B50014B06D /* UISegmentedControlTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1C882F1D071639000B888F /* UISegmentedControlTests.swift */; }; - 7D2AA99B1CB6EFEB008AB5C9 /* UISwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D2AA99A1CB6EFEB008AB5C9 /* UISwitch.swift */; }; 7D2AA99D1CB6F275008AB5C9 /* UISwitchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D2AA99C1CB6F275008AB5C9 /* UISwitchTests.swift */; }; 7D5FE3081CD4B04E00834675 /* UITextFieldTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7932E851C4B420A00086F3C /* UITextFieldTests.swift */; }; - 7DBD48F31CC8141D0077AD4F /* Reusable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DBD48F21CC8141D0077AD4F /* Reusable.swift */; }; - 7DBD48F41CC8141D0077AD4F /* Reusable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DBD48F21CC8141D0077AD4F /* Reusable.swift */; }; - 7DC325741CC6FCF100746D88 /* UITableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC325721CC6FCF100746D88 /* UITableViewCell.swift */; }; - 7DC325751CC6FCF100746D88 /* UITableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC325721CC6FCF100746D88 /* UITableViewCell.swift */; }; - 7DC325761CC6FCF100746D88 /* UITableViewHeaderFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC325731CC6FCF100746D88 /* UITableViewHeaderFooterView.swift */; }; - 7DC325771CC6FCF100746D88 /* UITableViewHeaderFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC325731CC6FCF100746D88 /* UITableViewHeaderFooterView.swift */; }; 7DC3257E1CC6FD1C00746D88 /* UITableViewCellTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC325781CC6FD0A00746D88 /* UITableViewCellTests.swift */; }; 7DC3257F1CC6FD1E00746D88 /* UITableViewCellTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC325781CC6FD0A00746D88 /* UITableViewCellTests.swift */; }; 7DC325801CC6FD2100746D88 /* UITableViewHeaderFooterViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC325791CC6FD0A00746D88 /* UITableViewHeaderFooterViewTests.swift */; }; 7DC325811CC6FD2300746D88 /* UITableViewHeaderFooterViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC325791CC6FD0A00746D88 /* UITableViewHeaderFooterViewTests.swift */; }; - 7DCF5B331CC80D77004AEE75 /* UICollectionReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DCF5B311CC80D0E004AEE75 /* UICollectionReusableView.swift */; }; - 7DCF5B341CC80D78004AEE75 /* UICollectionReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DCF5B311CC80D0E004AEE75 /* UICollectionReusableView.swift */; }; 7DCF5B361CC80E8E004AEE75 /* UICollectionReusableViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DCF5B351CC80E8E004AEE75 /* UICollectionReusableViewTests.swift */; }; 7DCF5B371CC80E8E004AEE75 /* UICollectionReusableViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DCF5B351CC80E8E004AEE75 /* UICollectionReusableViewTests.swift */; }; 8289A2E11BD7EF1F0097FB60 /* UIImageViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8289A2E01BD7EF1F0097FB60 /* UIImageViewTests.swift */; }; - 8289A2E31BD7EF740097FB60 /* UIImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8289A2E21BD7EF740097FB60 /* UIImageView.swift */; }; - 8289A2E51BD7F6DD0097FB60 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8289A2E41BD7F6DD0097FB60 /* UIView.swift */; }; 8289A2E81BD7F7900097FB60 /* UIViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8289A2E61BD7F7730097FB60 /* UIViewTests.swift */; }; 8295FD871B87309F007C9000 /* UIControlTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8295FD851B873081007C9000 /* UIControlTests.swift */; }; 8295FD8A1B87352D007C9000 /* UIButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8295FD881B873490007C9000 /* UIButtonTests.swift */; }; 8295FD8D1B87374A007C9000 /* UIBarButtonItemTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8295FD8B1B873748007C9000 /* UIBarButtonItemTests.swift */; }; - 9DA915A41CA6301C003723B9 /* UIDatePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DA915A31CA6301C003723B9 /* UIDatePicker.swift */; }; 9DA915A61CA63046003723B9 /* UIDatePickerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DA915A51CA63046003723B9 /* UIDatePickerTests.swift */; }; C72CF3E51CBF188A00E19897 /* RACSignal.swift in Sources */ = {isa = PBXBuildFile; fileRef = C72CF3E41CBF188A00E19897 /* RACSignal.swift */; }; C72CF3E61CBF188A00E19897 /* RACSignal.swift in Sources */ = {isa = PBXBuildFile; fileRef = C72CF3E41CBF188A00E19897 /* RACSignal.swift */; }; C72CF3E71CBF188A00E19897 /* RACSignal.swift in Sources */ = {isa = PBXBuildFile; fileRef = C72CF3E41CBF188A00E19897 /* RACSignal.swift */; }; C72CF3E81CBF188A00E19897 /* RACSignal.swift in Sources */ = {isa = PBXBuildFile; fileRef = C72CF3E41CBF188A00E19897 /* RACSignal.swift */; }; - C7932E831C4B3F3000086F3C /* UITextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7932E811C4B3EDB00086F3C /* UITextField.swift */; }; - C7932E841C4B41E100086F3C /* UITextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7932E811C4B3EDB00086F3C /* UITextField.swift */; }; C7932E871C4B42F500086F3C /* UITextFieldTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7932E851C4B420A00086F3C /* UITextFieldTests.swift */; }; C7945F111CC192E800DC9E37 /* UIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7945F101CC192E800DC9E37 /* UIViewController.swift */; }; C7945F141CC1DFBE00DC9E37 /* UIViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7945F121CC1DFB400DC9E37 /* UIViewControllerTests.swift */; }; - C7DCE2B41CB3C89A001217D8 /* UITextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7DCE2B21CB3C872001217D8 /* UITextView.swift */; }; C7DCE2B71CB3C9D6001217D8 /* UITextViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7DCE2B51CB3C9C1001217D8 /* UITextViewTests.swift */; }; CC02C18A1CCA704E0025CC04 /* ActionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC02C1881CCA704C0025CC04 /* ActionTests.swift */; }; CC02C18B1CCA704F0025CC04 /* ActionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC02C1881CCA704C0025CC04 /* ActionTests.swift */; }; @@ -79,10 +74,8 @@ D86FFBD11B34AD6F001A89B3 /* Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD01B34AD6F001A89B3 /* Association.swift */; }; D86FFBD21B34AD7A001A89B3 /* Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD01B34AD6F001A89B3 /* Association.swift */; }; D86FFBD61B34B116001A89B3 /* UIControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD41B34B0FE001A89B3 /* UIControl.swift */; }; - D86FFBD81B34B242001A89B3 /* UILabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD71B34B242001A89B3 /* UILabel.swift */; }; D86FFBDA1B34B3F0001A89B3 /* Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD91B34B3F0001A89B3 /* Action.swift */; }; D86FFBDB1B34B3F0001A89B3 /* Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD91B34B3F0001A89B3 /* Action.swift */; }; - D86FFBDD1B34B691001A89B3 /* UIButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBDC1B34B691001A89B3 /* UIButton.swift */; }; D8715D9D1C210FF9005F4191 /* Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD91B34B3F0001A89B3 /* Action.swift */; }; D8715D9E1C210FF9005F4191 /* Property.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A454051BD26A1A00C9E790 /* Property.swift */; }; D8715D9F1C210FF9005F4191 /* Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8003EBC1AFED01000D7D3C5 /* Signal.swift */; }; @@ -91,7 +84,6 @@ D8715DA21C211014005F4191 /* Rex.h in Headers */ = {isa = PBXBuildFile; fileRef = D8003E931AFEC3D400D7D3C5 /* Rex.h */; settings = {ATTRIBUTES = (Public, ); }; }; D8715DA31C21107F005F4191 /* Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD01B34AD6F001A89B3 /* Association.swift */; }; D8715DA41C21107F005F4191 /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0973A1B17F2F7002E15BA /* NSData.swift */; }; - D8715DA51C21107F005F4191 /* NSObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F097431B17F3C8002E15BA /* NSObject.swift */; }; D8715DA61C21107F005F4191 /* NSUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0973C1B17F30D002E15BA /* NSUserDefaults.swift */; }; D8715DA91C2110DA005F4191 /* ReactiveCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8715DA71C2110DA005F4191 /* ReactiveCocoa.framework */; }; D8715DAA1C2110DA005F4191 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8715DA81C2110DA005F4191 /* Result.framework */; }; @@ -102,17 +94,10 @@ D8715DBD1C2112D1005F4191 /* SignalProducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8003EB81AFEC7A900D7D3C5 /* SignalProducer.swift */; }; D8715DBE1C2112D6005F4191 /* Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD01B34AD6F001A89B3 /* Association.swift */; }; D8715DBF1C2112D6005F4191 /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0973A1B17F2F7002E15BA /* NSData.swift */; }; - D8715DC01C2112D6005F4191 /* NSObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F097431B17F3C8002E15BA /* NSObject.swift */; }; D8715DC11C2112D6005F4191 /* NSUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0973C1B17F30D002E15BA /* NSUserDefaults.swift */; }; D8715DC41C211310005F4191 /* ReactiveCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8715DC21C211310005F4191 /* ReactiveCocoa.framework */; }; D8715DC51C211310005F4191 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8715DC31C211310005F4191 /* Result.framework */; }; - D8715DC61C211553005F4191 /* UIBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5173EBC71B625A6800C9B48E /* UIBarButtonItem.swift */; }; - D8715DC71C211553005F4191 /* UIBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5173EBC51B625A2600C9B48E /* UIBarItem.swift */; }; - D8715DC81C211553005F4191 /* UIButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBDC1B34B691001A89B3 /* UIButton.swift */; }; D8715DC91C211553005F4191 /* UIControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD41B34B0FE001A89B3 /* UIControl.swift */; }; - D8715DCA1C211553005F4191 /* UILabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D86FFBD71B34B242001A89B3 /* UILabel.swift */; }; - D8715DCB1C211553005F4191 /* UIImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8289A2E21BD7EF740097FB60 /* UIImageView.swift */; }; - D8715DCC1C211553005F4191 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8289A2E41BD7F6DD0097FB60 /* UIView.swift */; }; D8715DDC1C211637005F4191 /* PropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A454081BD2772700C9E790 /* PropertyTests.swift */; }; D8715DDD1C211637005F4191 /* SignalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8003EBE1AFED2F800D7D3C5 /* SignalTests.swift */; }; D8715DDE1C211637005F4191 /* SignalProducerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8003EC01AFED30100D7D3C5 /* SignalProducerTests.swift */; }; @@ -131,21 +116,15 @@ D8A454071BD26A1A00C9E790 /* Property.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A454051BD26A1A00C9E790 /* Property.swift */; }; D8A454091BD2772700C9E790 /* PropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A454081BD2772700C9E790 /* PropertyTests.swift */; }; D8A4540A1BD2772700C9E790 /* PropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A454081BD2772700C9E790 /* PropertyTests.swift */; }; - D8E4A6201B7BBB1600EAD8A8 /* UIBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5173EBC71B625A6800C9B48E /* UIBarButtonItem.swift */; }; - D8E4A6211B7BBB2100EAD8A8 /* UIBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5173EBC51B625A2600C9B48E /* UIBarItem.swift */; }; D8F073161B863CE70047D546 /* UILabelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F073141B861B3A0047D546 /* UILabelTests.swift */; }; D8F0973B1B17F2F7002E15BA /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0973A1B17F2F7002E15BA /* NSData.swift */; }; D8F0973D1B17F30D002E15BA /* NSUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0973C1B17F30D002E15BA /* NSUserDefaults.swift */; }; D8F0973E1B17F30D002E15BA /* NSUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0973C1B17F30D002E15BA /* NSUserDefaults.swift */; }; D8F0973F1B17F31E002E15BA /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0973A1B17F2F7002E15BA /* NSData.swift */; }; - D8F097441B17F3C8002E15BA /* NSObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F097431B17F3C8002E15BA /* NSObject.swift */; }; - D8F097451B17F3C8002E15BA /* NSObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F097431B17F3C8002E15BA /* NSObject.swift */; }; D8F0974A1B17F5E1002E15BA /* NSObjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F097471B17F5DD002E15BA /* NSObjectTests.swift */; }; D8F0974B1B17F5E2002E15BA /* NSObjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F097471B17F5DD002E15BA /* NSObjectTests.swift */; }; E6933BEA1CD9C335006F7CE7 /* UIProgressViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6933BE81CD9C1F1006F7CE7 /* UIProgressViewTests.swift */; }; E6933BEB1CD9C363006F7CE7 /* UIProgressViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6933BE81CD9C1F1006F7CE7 /* UIProgressViewTests.swift */; }; - E6933BEC1CD9C37D006F7CE7 /* UIProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6933BE61CD9C0B2006F7CE7 /* UIProgressView.swift */; }; - E6933BED1CD9C37D006F7CE7 /* UIProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6933BE61CD9C0B2006F7CE7 /* UIProgressView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -179,6 +158,7 @@ dstPath = ""; dstSubfolderSpec = 16; files = ( + 216B3F3E1DC6B03500E1DFAC /* ReactiveSwift.framework in CopyFiles */, D8003EB41AFEC6B000D7D3C5 /* ReactiveCocoa.framework in CopyFiles */, D8003EB51AFEC6B000D7D3C5 /* Result.framework in CopyFiles */, ); @@ -190,6 +170,7 @@ dstPath = ""; dstSubfolderSpec = 16; files = ( + 216B3F3F1DC6B04A00E1DFAC /* ReactiveSwift.framework in CopyFiles */, D83457391AFEE4BE0070616A /* ReactiveCocoa.framework in CopyFiles */, D834573A1AFEE4BE0070616A /* Result.framework in CopyFiles */, ); @@ -201,6 +182,7 @@ dstPath = ""; dstSubfolderSpec = 16; files = ( + 216B3F401DC6B06E00E1DFAC /* ReactiveSwift.framework in CopyFiles */, D8715DE91C211739005F4191 /* ReactiveCocoa.framework in CopyFiles */, D8715DEA1C211739005F4191 /* Result.framework in CopyFiles */, ); @@ -209,38 +191,28 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 4238D5951B4D5950008534C0 /* NSTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; name = NSTextField.swift; path = AppKit/NSTextField.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - 45CED46B1D27BB8700788BDC /* UIActivityIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIActivityIndicatorView.swift; sourceTree = ""; }; + 216B3F321DC6AFAC00E1DFAC /* ReactiveSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveSwift.framework; path = watchOS/ReactiveSwift.framework; sourceTree = ""; }; + 216B3F351DC6AFDD00E1DFAC /* ReactiveSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveSwift.framework; path = tvOS/ReactiveSwift.framework; sourceTree = ""; }; + 216B3F381DC6AFEC00E1DFAC /* ReactiveSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ReactiveSwift.framework; sourceTree = ""; }; + 216B3F3B1DC6AFF800E1DFAC /* ReactiveSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ReactiveSwift.framework; sourceTree = ""; }; + 21A374861DC68E8D00521C86 /* Deprecations+Removals.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Deprecations+Removals.swift"; sourceTree = ""; }; 45CED46D1D27C1D400788BDC /* UIActivityIndicatorViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIActivityIndicatorViewTests.swift; sourceTree = ""; }; - 5173EBC51B625A2600C9B48E /* UIBarItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIBarItem.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - 5173EBC71B625A6800C9B48E /* UIBarButtonItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIBarButtonItem.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - 5B1C882D1D0715CE000B888F /* UISegmentedControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UISegmentedControl.swift; sourceTree = ""; }; 5B1C882F1D071639000B888F /* UISegmentedControlTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UISegmentedControlTests.swift; sourceTree = ""; }; 7D0DABA91CCC381F00B6CD2B /* UIControl+EnableSendActionsForControlEvents.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIControl+EnableSendActionsForControlEvents.swift"; sourceTree = ""; }; - 7D2AA99A1CB6EFEB008AB5C9 /* UISwitch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UISwitch.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 7D2AA99C1CB6F275008AB5C9 /* UISwitchTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UISwitchTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - 7DBD48F21CC8141D0077AD4F /* Reusable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reusable.swift; sourceTree = ""; }; - 7DC325721CC6FCF100746D88 /* UITableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UITableViewCell.swift; sourceTree = ""; }; - 7DC325731CC6FCF100746D88 /* UITableViewHeaderFooterView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UITableViewHeaderFooterView.swift; sourceTree = ""; }; 7DC325781CC6FD0A00746D88 /* UITableViewCellTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UITableViewCellTests.swift; sourceTree = ""; }; 7DC325791CC6FD0A00746D88 /* UITableViewHeaderFooterViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UITableViewHeaderFooterViewTests.swift; sourceTree = ""; }; - 7DCF5B311CC80D0E004AEE75 /* UICollectionReusableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionReusableView.swift; sourceTree = ""; }; 7DCF5B351CC80E8E004AEE75 /* UICollectionReusableViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionReusableViewTests.swift; sourceTree = ""; }; 8289A2E01BD7EF1F0097FB60 /* UIImageViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIImageViewTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - 8289A2E21BD7EF740097FB60 /* UIImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIImageView.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - 8289A2E41BD7F6DD0097FB60 /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIView.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 8289A2E61BD7F7730097FB60 /* UIViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIViewTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 8295FD851B873081007C9000 /* UIControlTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIControlTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 8295FD881B873490007C9000 /* UIButtonTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIButtonTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 8295FD8B1B873748007C9000 /* UIBarButtonItemTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIBarButtonItemTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - 9DA915A31CA6301C003723B9 /* UIDatePicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIDatePicker.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 9DA915A51CA63046003723B9 /* UIDatePickerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIDatePickerTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C72CF3E41CBF188A00E19897 /* RACSignal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RACSignal.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - C7932E811C4B3EDB00086F3C /* UITextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UITextField.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C7932E851C4B420A00086F3C /* UITextFieldTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UITextFieldTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C7945F101CC192E800DC9E37 /* UIViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C7945F121CC1DFB400DC9E37 /* UIViewControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIViewControllerTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - C7DCE2B21CB3C872001217D8 /* UITextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UITextView.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C7DCE2B51CB3C9C1001217D8 /* UITextViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UITextViewTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; CC02C1881CCA704C0025CC04 /* ActionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionTests.swift; sourceTree = ""; }; D8003E921AFEC3D400D7D3C5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -260,9 +232,7 @@ D86E77AC1AFEE646004BF23D /* RexTests-iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RexTests-iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; D86FFBD01B34AD6F001A89B3 /* Association.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Association.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; D86FFBD41B34B0FE001A89B3 /* UIControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIControl.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - D86FFBD71B34B242001A89B3 /* UILabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UILabel.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; D86FFBD91B34B3F0001A89B3 /* Action.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Action.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - D86FFBDC1B34B691001A89B3 /* UIButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UIButton.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; D8715D941C210F97005F4191 /* Rex.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Rex.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D8715DA71C2110DA005F4191 /* ReactiveCocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveCocoa.framework; path = watchOS/ReactiveCocoa.framework; sourceTree = ""; }; D8715DA81C2110DA005F4191 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = watchOS/Result.framework; sourceTree = ""; }; @@ -275,9 +245,7 @@ D8F073141B861B3A0047D546 /* UILabelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UILabelTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; D8F0973A1B17F2F7002E15BA /* NSData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = NSData.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; D8F0973C1B17F30D002E15BA /* NSUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = NSUserDefaults.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - D8F097431B17F3C8002E15BA /* NSObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = NSObject.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; D8F097471B17F5DD002E15BA /* NSObjectTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = NSObjectTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; - E6933BE61CD9C0B2006F7CE7 /* UIProgressView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIProgressView.swift; sourceTree = ""; }; E6933BE81CD9C1F1006F7CE7 /* UIProgressViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIProgressViewTests.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -288,6 +256,7 @@ files = ( D83457321AFEE4930070616A /* ReactiveCocoa.framework in Frameworks */, D83457331AFEE4930070616A /* Result.framework in Frameworks */, + 216B3F391DC6AFEC00E1DFAC /* ReactiveSwift.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -297,6 +266,7 @@ files = ( D8003EC51AFED36F00D7D3C5 /* ReactiveCocoa.framework in Frameworks */, D8003EC61AFED36F00D7D3C5 /* Result.framework in Frameworks */, + 216B3F3A1DC6AFEC00E1DFAC /* ReactiveSwift.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -306,6 +276,7 @@ files = ( D83457351AFEE4B20070616A /* ReactiveCocoa.framework in Frameworks */, D83457361AFEE4B20070616A /* Result.framework in Frameworks */, + 216B3F3C1DC6AFF800E1DFAC /* ReactiveSwift.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -315,6 +286,7 @@ files = ( D834573C1AFEE57E0070616A /* ReactiveCocoa.framework in Frameworks */, D834573D1AFEE57E0070616A /* Result.framework in Frameworks */, + 216B3F3D1DC6AFF800E1DFAC /* ReactiveSwift.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -324,6 +296,7 @@ files = ( D8715DA91C2110DA005F4191 /* ReactiveCocoa.framework in Frameworks */, D8715DAA1C2110DA005F4191 /* Result.framework in Frameworks */, + 216B3F341DC6AFAC00E1DFAC /* ReactiveSwift.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -333,6 +306,7 @@ files = ( D8715DC41C211310005F4191 /* ReactiveCocoa.framework in Frameworks */, D8715DC51C211310005F4191 /* Result.framework in Frameworks */, + 216B3F361DC6AFDD00E1DFAC /* ReactiveSwift.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -342,20 +316,13 @@ files = ( D8715DE61C21170C005F4191 /* ReactiveCocoa.framework in Frameworks */, D8715DE71C21170C005F4191 /* Result.framework in Frameworks */, + 216B3F371DC6AFDD00E1DFAC /* ReactiveSwift.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 4238D5941B4D593E008534C0 /* AppKit */ = { - isa = PBXGroup; - children = ( - 4238D5951B4D5950008534C0 /* NSTextField.swift */, - ); - name = AppKit; - sourceTree = ""; - }; 7D0DABA81CCC380700B6CD2B /* Helpers */ = { isa = PBXGroup; children = ( @@ -381,8 +348,6 @@ D8003EBC1AFED01000D7D3C5 /* Signal.swift */, D8003EB81AFEC7A900D7D3C5 /* SignalProducer.swift */, C72CF3E41CBF188A00E19897 /* RACSignal.swift */, - 7DBD48F21CC8141D0077AD4F /* Reusable.swift */, - 4238D5941B4D593E008534C0 /* AppKit */, D8F097391B17F2BF002E15BA /* Foundation */, D86FFBD31B34B0E2001A89B3 /* UIKit */, D8003E911AFEC3D400D7D3C5 /* Supporting Files */, @@ -395,6 +360,7 @@ children = ( D8003E931AFEC3D400D7D3C5 /* Rex.h */, D8003E921AFEC3D400D7D3C5 /* Info.plist */, + 21A374861DC68E8D00521C86 /* Deprecations+Removals.swift */, ); name = "Supporting Files"; sourceTree = ""; @@ -439,6 +405,7 @@ children = ( D86E77A91AFEE646004BF23D /* Rex.framework */, D86E77AA1AFEE646004BF23D /* RexTests-Mac.xctest */, + 216B3F381DC6AFEC00E1DFAC /* ReactiveSwift.framework */, D8003EAD1AFEC68A00D7D3C5 /* ReactiveCocoa.framework */, D8003EAE1AFEC68A00D7D3C5 /* Result.framework */, ); @@ -450,6 +417,7 @@ children = ( D86E77AB1AFEE646004BF23D /* Rex.framework */, D86E77AC1AFEE646004BF23D /* RexTests-iOS.xctest */, + 216B3F3B1DC6AFF800E1DFAC /* ReactiveSwift.framework */, D8003EC91AFEE3ED00D7D3C5 /* ReactiveCocoa.framework */, D8003ECA1AFEE3ED00D7D3C5 /* Result.framework */, ); @@ -459,23 +427,7 @@ D86FFBD31B34B0E2001A89B3 /* UIKit */ = { isa = PBXGroup; children = ( - 45CED46B1D27BB8700788BDC /* UIActivityIndicatorView.swift */, - 5173EBC71B625A6800C9B48E /* UIBarButtonItem.swift */, - 5173EBC51B625A2600C9B48E /* UIBarItem.swift */, - D86FFBDC1B34B691001A89B3 /* UIButton.swift */, - 7DCF5B311CC80D0E004AEE75 /* UICollectionReusableView.swift */, D86FFBD41B34B0FE001A89B3 /* UIControl.swift */, - 9DA915A31CA6301C003723B9 /* UIDatePicker.swift */, - 8289A2E21BD7EF740097FB60 /* UIImageView.swift */, - D86FFBD71B34B242001A89B3 /* UILabel.swift */, - E6933BE61CD9C0B2006F7CE7 /* UIProgressView.swift */, - 7D2AA99A1CB6EFEB008AB5C9 /* UISwitch.swift */, - 5B1C882D1D0715CE000B888F /* UISegmentedControl.swift */, - 7DC325721CC6FCF100746D88 /* UITableViewCell.swift */, - 7DC325731CC6FCF100746D88 /* UITableViewHeaderFooterView.swift */, - C7932E811C4B3EDB00086F3C /* UITextField.swift */, - C7DCE2B21CB3C872001217D8 /* UITextView.swift */, - 8289A2E41BD7F6DD0097FB60 /* UIView.swift */, C7945F101CC192E800DC9E37 /* UIViewController.swift */, ); path = UIKit; @@ -485,6 +437,7 @@ isa = PBXGroup; children = ( D8715D941C210F97005F4191 /* Rex.framework */, + 216B3F321DC6AFAC00E1DFAC /* ReactiveSwift.framework */, D8715DA71C2110DA005F4191 /* ReactiveCocoa.framework */, D8715DA81C2110DA005F4191 /* Result.framework */, ); @@ -496,6 +449,7 @@ children = ( D8715DB01C21123E005F4191 /* Rex.framework */, D8715DD11C21160A005F4191 /* RexTests-tvOS.xctest */, + 216B3F351DC6AFDD00E1DFAC /* ReactiveSwift.framework */, D8715DC21C211310005F4191 /* ReactiveCocoa.framework */, D8715DC31C211310005F4191 /* Result.framework */, ); @@ -531,7 +485,6 @@ children = ( D86FFBD01B34AD6F001A89B3 /* Association.swift */, D8F0973A1B17F2F7002E15BA /* NSData.swift */, - D8F097431B17F3C8002E15BA /* NSObject.swift */, D8F0973C1B17F30D002E15BA /* NSUserDefaults.swift */, ); path = Foundation; @@ -719,36 +672,36 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0810; ORGANIZATIONNAME = "Neil Pankey"; TargetAttributes = { D8003E8D1AFEC3D400D7D3C5 = { CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0800; + LastSwiftMigration = 0810; }; D8003E981AFEC3D400D7D3C5 = { CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0800; + LastSwiftMigration = 0810; }; D83457131AFEE44E0070616A = { CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0800; + LastSwiftMigration = 0810; }; D834571D1AFEE44E0070616A = { CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0800; + LastSwiftMigration = 0810; }; D8715D931C210F97005F4191 = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0810; }; D8715DAF1C21123E005F4191 = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0810; }; D8715DD01C21160A005F4191 = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0810; }; }; }; @@ -838,9 +791,8 @@ D86FFBD11B34AD6F001A89B3 /* Association.swift in Sources */, D8003EB91AFEC7A900D7D3C5 /* SignalProducer.swift in Sources */, D8003EBD1AFED01000D7D3C5 /* Signal.swift in Sources */, - D8F097441B17F3C8002E15BA /* NSObject.swift in Sources */, + 21A374871DC68E8D00521C86 /* Deprecations+Removals.swift in Sources */, D8F0973B1B17F2F7002E15BA /* NSData.swift in Sources */, - 4238D5961B4D5950008534C0 /* NSTextField.swift in Sources */, D8F0973D1B17F30D002E15BA /* NSUserDefaults.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -861,34 +813,17 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9DA915A41CA6301C003723B9 /* UIDatePicker.swift in Sources */, - D86FFBD81B34B242001A89B3 /* UILabel.swift in Sources */, - 7DCF5B331CC80D77004AEE75 /* UICollectionReusableView.swift in Sources */, D86FFBDB1B34B3F0001A89B3 /* Action.swift in Sources */, D86FFBD21B34AD7A001A89B3 /* Association.swift in Sources */, - C7932E831C4B3F3000086F3C /* UITextField.swift in Sources */, - 7DC325761CC6FCF100746D88 /* UITableViewHeaderFooterView.swift in Sources */, - 7DC325741CC6FCF100746D88 /* UITableViewCell.swift in Sources */, - 5B7F81E31D0842AD0014B06D /* UISegmentedControl.swift in Sources */, - 8289A2E31BD7EF740097FB60 /* UIImageView.swift in Sources */, D8F0973E1B17F30D002E15BA /* NSUserDefaults.swift in Sources */, + 21A374881DC69D0800521C86 /* Deprecations+Removals.swift in Sources */, D834572D1AFEE45B0070616A /* Signal.swift in Sources */, - D8E4A6211B7BBB2100EAD8A8 /* UIBarItem.swift in Sources */, - 7D2AA99B1CB6EFEB008AB5C9 /* UISwitch.swift in Sources */, - 7DBD48F31CC8141D0077AD4F /* Reusable.swift in Sources */, C72CF3E61CBF188A00E19897 /* RACSignal.swift in Sources */, D8A454071BD26A1A00C9E790 /* Property.swift in Sources */, - D8E4A6201B7BBB1600EAD8A8 /* UIBarButtonItem.swift in Sources */, - D8F097451B17F3C8002E15BA /* NSObject.swift in Sources */, C7945F111CC192E800DC9E37 /* UIViewController.swift in Sources */, - E6933BEC1CD9C37D006F7CE7 /* UIProgressView.swift in Sources */, D834572E1AFEE45B0070616A /* SignalProducer.swift in Sources */, - C7DCE2B41CB3C89A001217D8 /* UITextView.swift in Sources */, - 8289A2E51BD7F6DD0097FB60 /* UIView.swift in Sources */, D86FFBD61B34B116001A89B3 /* UIControl.swift in Sources */, D8F0973F1B17F31E002E15BA /* NSData.swift in Sources */, - D86FFBDD1B34B691001A89B3 /* UIButton.swift in Sources */, - 45CED4711D27C1EB00788BDC /* UIActivityIndicatorView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -929,7 +864,7 @@ D8715D9E1C210FF9005F4191 /* Property.swift in Sources */, D8715DA01C210FF9005F4191 /* SignalProducer.swift in Sources */, D8715DA31C21107F005F4191 /* Association.swift in Sources */, - D8715DA51C21107F005F4191 /* NSObject.swift in Sources */, + 21A3748A1DC69D0900521C86 /* Deprecations+Removals.swift in Sources */, D8715D9F1C210FF9005F4191 /* Signal.swift in Sources */, C72CF3E81CBF188A00E19897 /* RACSignal.swift in Sources */, D8715DA41C21107F005F4191 /* NSData.swift in Sources */, @@ -943,28 +878,15 @@ buildActionMask = 2147483647; files = ( D8715DBB1C2112D1005F4191 /* Property.swift in Sources */, - D8715DCA1C211553005F4191 /* UILabel.swift in Sources */, - 7DCF5B341CC80D78004AEE75 /* UICollectionReusableView.swift in Sources */, - D8715DCB1C211553005F4191 /* UIImageView.swift in Sources */, - C7932E841C4B41E100086F3C /* UITextField.swift in Sources */, - 7DBD48F41CC8141D0077AD4F /* Reusable.swift in Sources */, - D8715DC61C211553005F4191 /* UIBarButtonItem.swift in Sources */, D8715DBD1C2112D1005F4191 /* SignalProducer.swift in Sources */, D8715DBE1C2112D6005F4191 /* Association.swift in Sources */, - 7DC325771CC6FCF100746D88 /* UITableViewHeaderFooterView.swift in Sources */, - D8715DC01C2112D6005F4191 /* NSObject.swift in Sources */, D8715DC91C211553005F4191 /* UIControl.swift in Sources */, - 7DC325751CC6FCF100746D88 /* UITableViewCell.swift in Sources */, D8715DBC1C2112D1005F4191 /* Signal.swift in Sources */, C72CF3E71CBF188A00E19897 /* RACSignal.swift in Sources */, - E6933BED1CD9C37D006F7CE7 /* UIProgressView.swift in Sources */, D8715DBF1C2112D6005F4191 /* NSData.swift in Sources */, - D8715DCC1C211553005F4191 /* UIView.swift in Sources */, + 21A374891DC69D0900521C86 /* Deprecations+Removals.swift in Sources */, D8715DBA1C2112D1005F4191 /* Action.swift in Sources */, - D8715DC81C211553005F4191 /* UIButton.swift in Sources */, - D8715DC71C211553005F4191 /* UIBarItem.swift in Sources */, D8715DC11C2112D6005F4191 /* NSUserDefaults.swift in Sources */, - 45CED4721D27C1EC00788BDC /* UIActivityIndicatorView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1026,8 +948,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; @@ -1074,8 +998,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; @@ -1094,6 +1020,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 2.3; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1123,6 +1050,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -1148,6 +1076,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "me.neilpa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -1168,6 +1097,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "me.neilpa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -1184,6 +1114,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "me.neilpa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -1192,6 +1123,7 @@ buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = ""; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; @@ -1214,6 +1146,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -1223,6 +1156,7 @@ buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1240,6 +1174,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -1265,6 +1200,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "me.neilpa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -1283,6 +1219,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "me.neilpa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_VERSION = 3.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -1291,6 +1228,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1306,6 +1244,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 4; WATCHOS_DEPLOYMENT_TARGET = 2.0; }; @@ -1315,6 +1254,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1330,6 +1270,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = watchos; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 4; VALIDATE_PRODUCT = YES; WATCHOS_DEPLOYMENT_TARGET = 2.0; @@ -1340,6 +1281,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1355,6 +1297,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = appletvos; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -1364,6 +1307,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1379,6 +1323,7 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = appletvos; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -1391,12 +1336,14 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/tvOS", + "$(PROJECT_DIR)/Carthage/Build/watchOS", ); INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = me.neilpa.RexTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; + SWIFT_VERSION = 3.0; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; @@ -1407,12 +1354,14 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/tvOS", + "$(PROJECT_DIR)/Carthage/Build/watchOS", ); INFOPLIST_FILE = Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = me.neilpa.RexTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; + SWIFT_VERSION = 3.0; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; }; diff --git a/Rex.xcodeproj/xcshareddata/xcschemes/Rex-Mac.xcscheme b/Rex.xcodeproj/xcshareddata/xcschemes/Rex-Mac.xcscheme index cc58cdc..ef765aa 100644 --- a/Rex.xcodeproj/xcshareddata/xcschemes/Rex-Mac.xcscheme +++ b/Rex.xcodeproj/xcshareddata/xcschemes/Rex-Mac.xcscheme @@ -1,6 +1,6 @@ { + return Action(enabledIf: Property(value: false)) { _ in .empty } } /// Whether the action execution was started. public var rex_started: Signal { - return self.executing.signal + return self.isExecuting.signal .filterMap { $0 ? () : nil } } @@ -25,7 +26,7 @@ extension Action { public var rex_completed: Signal { return events .filterMap { event -> Void? in - if case .Completed = event { + if case .completed = event { return () } else { return nil @@ -40,14 +41,4 @@ extension CocoaAction { public static var rex_disabled: CocoaAction { return CocoaAction(Action.rex_disabled, input: nil) } - - /// Creates a producer for the `enabled` state of a CocoaAction. - public var rex_enabledProducer: SignalProducer { - return rex_producerForKeyPath("enabled") - } - - /// Creates a producer for the `executing` state of a CocoaAction. - public var rex_executingProducer: SignalProducer { - return rex_producerForKeyPath("executing") - } } diff --git a/Source/AppKit/NSTextField.swift b/Source/AppKit/NSTextField.swift deleted file mode 100644 index cf14eee..0000000 --- a/Source/AppKit/NSTextField.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// NSTextField.swift -// Rex -// -// Created by Yury Lapitsky on 7/8/15. -// Copyright (c) 2015 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import AppKit -import enum Result.NoError - -extension NSTextField { - /// Sends the field's string value whenever it changes. - public var rex_textSignal: SignalProducer { - return NSNotificationCenter.defaultCenter() - .rac_notifications(NSControlTextDidChangeNotification, object: self) - .map { notification in - (notification.object as! NSTextField).stringValue - } - } -} diff --git a/Source/Deprecations+Removals.swift b/Source/Deprecations+Removals.swift new file mode 100644 index 0000000..b5bbc72 --- /dev/null +++ b/Source/Deprecations+Removals.swift @@ -0,0 +1,136 @@ +// +// Deprecations+Removals.swift +// Rex +// +// Created by Markus Chmelar on 30/10/2016. +// Copyright © 2016 Neil Pankey. All rights reserved. +// + +import ReactiveSwift +import ReactiveCocoa +import enum Result.NoError +#if os(OSX) +import AppKit +extension NSTextField { + @available(*, unavailable, renamed:"reactive.continuousStringValues") + public var rex_textSignal: SignalProducer { fatalError() } +} +#endif + +extension NSObject { + @available(*, unavailable, renamed:"reactive.lifetime.ended") + public var rex_willDealloc: Signal<(), NoError> { fatalError() } + + @available(*, unavailable, renamed:"reactive.values(forKeyPath:)") + public func rex_producerForKeyPath(_ keyPath: String) -> SignalProducer { fatalError() } +} + +#if os(iOS) +import UIKit +//@available(*, unavailable, message: "Reusable protocol has been moved to ReactiveCocoa in RAC 5.0. UI Extensions have been moved to RAC 5.0") +//public protocol Reusable { +// @available(*, unavailable, renamed:"reactive.prepareForReuse") +// var rac_prepareForReuseSignal: RACSignal! { get } +//} + +extension Reusable { + @available(*, unavailable, renamed:"reactive.prepareForReuse") + public var rex_prepareForReuse: Signal { fatalError() } +} + +extension CocoaAction { + @available(*, unavailable, renamed:"isEnabled") + public var rex_enabledProducer: SignalProducer { fatalError() } + @available(*, unavailable, renamed:"isExecuting") + public var rex_executingProducer: SignalProducer { fatalError() } +} + +extension UIActivityIndicatorView { + @available(*, unavailable, renamed:"reactive.isAnimating") + public var rex_animating: MutableProperty { fatalError() } + +} + +extension UIBarButtonItem { + @available(*, unavailable, renamed:"reactive.pressed") + public var rex_action: MutableProperty> { fatalError() } +} + +extension UIBarItem { + @available(*, unavailable, renamed:"reactive.isEnabled") + public var rex_enabled: MutableProperty { fatalError() } +} + +extension UIButton { + @available(*, unavailable, renamed:"reactive.pressed") + public var rex_pressed: MutableProperty> { fatalError() } + @available(*, unavailable, renamed:"reactive.title") + public var rex_title: MutableProperty { fatalError() } +} + +extension UIDatePicker { + @available(*, unavailable, renamed:"reactive.date") + public var rex_date: MutableProperty { fatalError() } +} + +extension UIImageView { + @available(*, unavailable, renamed:"reactive.image") + public var rex_image: MutableProperty { fatalError() } + @available(*, unavailable, renamed:"reactive.highlightedImage") + public var rex_highlightedImage: MutableProperty { fatalError() } +} + +extension UILabel { + @available(*, unavailable, renamed:"reactive.text") + public var rex_text: MutableProperty { fatalError() } + @available(*, unavailable, renamed:"reactive.attributedText") + public var rex_attributedText: MutableProperty { fatalError() } + @available(*, unavailable, renamed:"reactive.textColor") + public var rex_textColor: MutableProperty { fatalError() } +} + +extension UIControl { + @available(*, unavailable, renamed:"reactive.trigger(for:)") + public func rex_controlEvents(_ events: UIControlEvents) -> SignalProducer { fatalError() } + @available(*, unavailable, renamed:"reactive.isEnabled") + public var rex_enabled: MutableProperty { fatalError() } + @available(*, unavailable, renamed:"reactive.isSelected") + public var rex_selected: MutableProperty { fatalError() } + @available(*, unavailable, renamed:"reactive.isHighlighted") + public var rex_highlighted: MutableProperty { fatalError() } +} + +extension UIProgressView { + @available(*, unavailable, renamed:"reactive.progress") + public var rex_progress: MutableProperty { fatalError() } +} + +extension UISegmentedControl { + @available(*, unavailable, renamed:"reactive.selectedSegmentIndex") + public var rex_selectedSegmentIndex: MutableProperty { fatalError() } +} + +extension UISwitch { + @available(*, unavailable, renamed:"reactive.isOn") + public var rex_on: MutableProperty { fatalError() } +} + +extension UITextField { + @available(*, unavailable, renamed:"reactive.text") + public var rex_text: MutableProperty { fatalError() } +} + +extension UITextView { + @available(*, unavailable, renamed:"reactive.text") + public var rex_text: SignalProducer { fatalError() } +} + +extension UIView { + @available(*, unavailable, renamed:"reactive.alpha") + public var rex_alpha: MutableProperty { fatalError() } + @available(*, unavailable, renamed:"reactive.isHidden") + public var rex_hidden: MutableProperty { fatalError() } + @available(*, unavailable, renamed:"reactive.isUserInteractionEnabled") + public var rex_userInteractionEnabled: MutableProperty { fatalError() } +} +#endif diff --git a/Source/Foundation/Association.swift b/Source/Foundation/Association.swift index 976b6c9..d92a11b 100644 --- a/Source/Foundation/Association.swift +++ b/Source/Foundation/Association.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift /// Attaches a `MutableProperty` value to the `host` object using KVC to get the initial /// value and write subsequent updates from the property's producer. Note that `keyPath` @@ -15,13 +15,13 @@ import ReactiveCocoa /// /// This can be used as an alternative to `DynamicProperty` for creating strongly typed /// bindings on Cocoa objects. -@warn_unused_result(message="Did you forget to use the property?") -public func associatedProperty(host: AnyObject, keyPath: StaticString) -> MutableProperty { - let initial: AnyObject -> String = { host in - host.valueForKeyPath(keyPath.stringValue) as? String ?? "" + +public func associatedProperty(_ host: AnyObject, keyPath: StaticString) -> MutableProperty { + let initial: (AnyObject) -> String = { host in + host.value(forKeyPath: keyPath.description) as? String ?? "" } let setter: (AnyObject, String) -> () = { host, newValue in - host.setValue(newValue, forKeyPath: keyPath.stringValue) + host.setValue(newValue, forKeyPath: keyPath.description) } return associatedProperty(host, key: keyPath.utf8Start, initial: initial, setter: setter) } @@ -33,13 +33,14 @@ public func associatedProperty(host: AnyObject, keyPath: StaticString) -> Mutabl /// /// This can be used as an alternative to `DynamicProperty` for creating strongly typed /// bindings on Cocoa objects. -@warn_unused_result(message="Did you forget to use the property?") -public func associatedProperty(host: AnyObject, keyPath: StaticString, @noescape placeholder: () -> T) -> MutableProperty { + +public func associatedProperty(_ host: AnyObject, keyPath: StaticString, placeholder: @escaping () -> T) -> MutableProperty { let setter: (AnyObject, T) -> () = { host, newValue in - host.setValue(newValue, forKeyPath: keyPath.stringValue) + host.setValue(newValue, forKeyPath: keyPath.description) } + return associatedProperty(host, key: keyPath.utf8Start, initial: { host in - host.valueForKeyPath(keyPath.stringValue) as? T ?? placeholder() + host.value(forKeyPath: keyPath.description) as? T ?? placeholder() }, setter: setter) } @@ -49,14 +50,14 @@ public func associatedProperty(host: AnyObject, keyPath: StaticStr /// /// This can be used as an alternative to `DynamicProperty` for creating strongly typed /// bindings on Cocoa objects. -@warn_unused_result(message="Did you forget to use the property?") -public func associatedProperty(host: Host, key: UnsafePointer<()>, @noescape initial: Host -> T, setter: (Host, T) -> (), @noescape setUp: MutableProperty -> () = { _ in }) -> MutableProperty { + +public func associatedProperty(_ host: Host, key: UnsafeRawPointer, initial: @escaping (Host) -> T, setter: @escaping (Host, T) -> (), setUp: (MutableProperty) -> () = { _ in }) -> MutableProperty { return associatedObject(host, key: key) { host in let property = MutableProperty(initial(host)) setUp(property) - property.producer.startWithNext { [weak host] next in + property.producer.startWithValues { [weak host] next in if let host = host { setter(host, next) } @@ -69,7 +70,7 @@ public func associatedProperty(host: Host, key: UnsafePointe /// On first use attaches the object returned from `initial` to the `host` object using /// `key` via `objc_setAssociatedObject`. On subsequent usage, returns said object via /// `objc_getAssociatedObject`. -public func associatedObject(host: Host, key: UnsafePointer<()>, @noescape initial: Host -> T) -> T { +public func associatedObject(_ host: Host, key: UnsafeRawPointer, initial: (Host) -> T) -> T { var value = objc_getAssociatedObject(host, key) as? T if value == nil { value = initial(host) diff --git a/Source/Foundation/NSData.swift b/Source/Foundation/NSData.swift index 1055125..367232f 100644 --- a/Source/Foundation/NSData.swift +++ b/Source/Foundation/NSData.swift @@ -6,19 +6,18 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift -extension NSData { +extension Data { /// Read the data at the URL, sending the result or an error. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public class func rex_dataWithContentsOfURL(url: NSURL, options: NSDataReadingOptions = NSDataReadingOptions()) -> SignalProducer { + public static func rex_dataWithContentsOfURL(_ url: NSURL, options: NSData.ReadingOptions = NSData.ReadingOptions()) -> SignalProducer { return SignalProducer { observer, disposable in do { - let data = try NSData(contentsOfURL: url, options: options) - observer.sendNext(data) + let data = try NSData(contentsOf: url as URL, options: options) + observer.send(value: data) observer.sendCompleted() } catch { - observer.sendFailed(error as NSError) + observer.send(error: error as NSError) } } } diff --git a/Source/Foundation/NSObject.swift b/Source/Foundation/NSObject.swift deleted file mode 100644 index c839ef1..0000000 --- a/Source/Foundation/NSObject.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// NSObject.swift -// Rex -// -// Created by Neil Pankey on 5/28/15. -// Copyright (c) 2015 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import enum Result.NoError - -extension NSObject { - /// Creates a strongly-typed producer to monitor `keyPath` via KVO. The caller - /// is responsible for ensuring that the associated value is castable to `T`. - /// - /// Swift classes deriving `NSObject` must declare properties as `dynamic` for - /// them to work with KVO. However, this is not recommended practice. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public func rex_producerForKeyPath(keyPath: String) -> SignalProducer { - return self.rac_valuesForKeyPath(keyPath, observer: nil) - .toSignalProducer() - .map { $0 as! T } - .flatMapError { error in - // Errors aren't possible, but the compiler doesn't know that. - assertionFailure("Unexpected error from KVO signal: \(error)") - return .empty - } - } - - /// Creates a signal that will be triggered when the object - /// is deallocated. - public var rex_willDealloc: Signal<(), NoError> { - return self - .rac_willDeallocSignal() - .rex_toTriggerSignal() - } -} diff --git a/Source/Foundation/NSUserDefaults.swift b/Source/Foundation/NSUserDefaults.swift index 702dd93..6921d37 100644 --- a/Source/Foundation/NSUserDefaults.swift +++ b/Source/Foundation/NSUserDefaults.swift @@ -6,30 +6,31 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import enum Result.NoError -extension NSUserDefaults { +extension UserDefaults { /// Sends value of `key` whenever it changes. Attempts to filter out repeats /// by casting to NSObject and checking for equality. If the values aren't /// convertible this will generate events whenever _any_ value in NSUserDefaults /// changes. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public func rex_valueForKey(key: String) -> SignalProducer { - let center = NSNotificationCenter.defaultCenter() - let initial = objectForKey(key) + + public func rex_valueForKey(_ key: String) -> SignalProducer { + let center = NotificationCenter.default + let initial = object(forKey: key) - let changes = center.rac_notifications(NSUserDefaultsDidChangeNotification) + let changesSignal = center.reactive.notifications(forName: UserDefaults.didChangeNotification) .map { _ in // The notification doesn't provide what changed so we have to look // it up every time - self.objectForKey(key) + self.object(forKey: key) } + let changes = SignalProducer(signal: changesSignal) - return SignalProducer(value: initial) + return SignalProducer(value: initial) .concat(changes) .skipRepeats { previous, next in - if let previous = previous as? NSObject, next = next as? NSObject { + if let previous = previous as? NSObject, let next = next as? NSObject { return previous == next } return false diff --git a/Source/Property.swift b/Source/Property.swift index 230d0ab..bd8ae08 100644 --- a/Source/Property.swift +++ b/Source/Property.swift @@ -6,44 +6,44 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import enum Result.NoError -extension PropertyType where Value == Bool { +extension PropertyProtocol where Value == Bool { /// The conjunction of `self` and `other`. - @warn_unused_result(message="Did you forget to use the property?") - public func and(other: P) -> AndProperty { - return AndProperty(terms: [AnyProperty(self), AnyProperty(other)]) + + public func and(_ other: P) -> AndProperty where P.Value == Bool { + return AndProperty(terms: [Property(self), Property(other)]) } /// The conjunction of `self` and `other`. - @warn_unused_result(message="Did you forget to use the property?") - public func and(other: AnyProperty) -> AndProperty { - return AndProperty(terms: [AnyProperty(self), other]) + + public func and(_ other: Property) -> AndProperty { + return AndProperty(terms: [Property(self), other]) } /// The disjunction of `self` and `other`. - @warn_unused_result(message="Did you forget to use the property?") - public func or(other: P) -> OrProperty { - return OrProperty(terms: [AnyProperty(self), AnyProperty(other)]) + + public func or(_ other: P) -> OrProperty where P.Value == Bool { + return OrProperty(terms: [Property(self), Property(other)]) } /// The disjunction of `self` and `other`. - @warn_unused_result(message="Did you forget to use the property?") - public func or(other: AnyProperty) -> OrProperty { - return OrProperty(terms: [AnyProperty(self), other]) + + public func or(_ other: Property) -> OrProperty { + return OrProperty(terms: [Property(self), other]) } /// A negated property of `self`. - @warn_unused_result(message="Did you forget to use the property?") + public func not() -> NotProperty { - return NotProperty(source: AnyProperty(self), invert: true) + return NotProperty(source: Property(self), invert: true) } } -/// Specialized `PropertyType` for the conjuction of a set of boolean properties. -public struct AndProperty: PropertyType { - public let terms: [AnyProperty] +/// Specialized `PropertyProtocol` for the conjuction of a set of boolean properties. +public final class AndProperty: PropertyProtocol { + public let terms: [Property] public var value: Bool { return terms.reduce(true) { $0 && $1.value } @@ -51,38 +51,38 @@ public struct AndProperty: PropertyType { public var producer: SignalProducer { let producers = terms.map { $0.producer } - return combineLatest(producers).map { values in + return SignalProducer.combineLatest(producers).map { values in return values.reduce(true) { $0 && $1 } } } public var signal: Signal { let signals = terms.map { $0.signal } - return combineLatest(signals).map { values in + return Signal.combineLatest(signals).map { values in return values.reduce(true) { $0 && $1 } } } /// Creates a new property with an additional conjunctive term. - @warn_unused_result(message="Did you forget to use the property?") - public func and

(other: P) -> AndProperty { - return AndProperty(terms: terms + [AnyProperty(other)]) + + public func and

(_ other: P) -> AndProperty where P.Value == Bool { + return AndProperty(terms: terms + [Property(other)]) } /// Creates a new property with an additional conjunctive term. - @warn_unused_result(message="Did you forget to use the property?") - public func and(other: AnyProperty) -> AndProperty { + + public func and(_ other: Property) -> AndProperty { return AndProperty(terms: terms + [other]) } - private init(terms: [AnyProperty]) { + fileprivate init(terms: [Property]) { self.terms = terms } } -/// Specialized `PropertyType` for the disjunction of a set of boolean properties. -public struct OrProperty: PropertyType { - public let terms: [AnyProperty] +/// Specialized `PropertyProtocol` for the disjunction of a set of boolean properties. +public final class OrProperty: PropertyProtocol { + public let terms: [Property] public var value: Bool { return terms.reduce(false) { $0 || $1.value } @@ -90,39 +90,39 @@ public struct OrProperty: PropertyType { public var producer: SignalProducer { let producers = terms.map { $0.producer } - return combineLatest(producers).map { values in + return SignalProducer.combineLatest(producers).map { values in return values.reduce(false) { $0 || $1 } } } public var signal: Signal { let signals = terms.map { $0.signal } - return combineLatest(signals).map { values in + return Signal.combineLatest(signals).map { values in return values.reduce(false) { $0 || $1 } } } /// Creates a new property with an additional disjunctive term. - @warn_unused_result(message="Did you forget to use the property?") - public func or

(other: P) -> OrProperty { - return OrProperty(terms: terms + [AnyProperty(other)]) + + public func or

(_ other: P) -> OrProperty where P.Value == Bool { + return OrProperty(terms: terms + [Property(other)]) } /// Creates a new property with an additional disjunctive term. - @warn_unused_result(message="Did you forget to use the property?") - public func or(other: AnyProperty) -> OrProperty { + + public func or(_ other: Property) -> OrProperty { return OrProperty(terms: terms + [other]) } - private init(terms: [AnyProperty]) { + fileprivate init(terms: [Property]) { self.terms = terms } } -/// Specialized `PropertyType` for the negation of a boolean property. -public struct NotProperty: PropertyType { - private let source: AnyProperty - private let invert: Bool +/// Specialized `PropertyProtocol` for the negation of a boolean property. +public final class NotProperty: PropertyProtocol { + fileprivate let source: Property + fileprivate let invert: Bool public var value: Bool { return source.value != invert @@ -137,12 +137,12 @@ public struct NotProperty: PropertyType { } /// A negated property of `self`. - @warn_unused_result(message="Did you forget to use the property?") + public func not() -> NotProperty { return NotProperty(source: source, invert: !invert) } - private init(source: AnyProperty, invert: Bool) { + fileprivate init(source: Property, invert: Bool) { self.source = source self.invert = invert } diff --git a/Source/RACSignal.swift b/Source/RACSignal.swift index 8d01fa5..cdb22e0 100644 --- a/Source/RACSignal.swift +++ b/Source/RACSignal.swift @@ -6,32 +6,32 @@ // Copyright © 2016 Neil Pankey. All rights reserved. // -import ReactiveCocoa -import enum Result.NoError - -extension RACSignal { - - /// Converts `self` into a `Signal`. - /// - /// Because the operator can't know whether `self` is hot or cold, - /// for certain things, like event streams (see `UIControl.signalForControlEvents`) - /// use this method to be able to expose these inherently hot streams - /// as `Signal`s. - @warn_unused_result(message="Did you forget to call `observe` on the signal?") - public func rex_toSignal() -> Signal { - return Signal { observer in - return self.toSignalProducer().start(observer) - } - } - - /// Converts `self` into a `Signal`, that can be used - /// with the `takeUntil` operator, or as an "activation" signal. - /// (e.g. a button) - @warn_unused_result(message="Did you forget to call `observe` on the signal?") - public final func rex_toTriggerSignal() -> Signal<(), NoError> { - return self - .rex_toSignal() - .map { _ in () } - .ignoreError() - } -} +//import ReactiveSwift +//import enum Result.NoError +// +//extension RACSignal { +// +// /// Converts `self` into a `Signal`. +// /// +// /// Because the operator can't know whether `self` is hot or cold, +// /// for certain things, like event streams (see `UIControl.signalForControlEvents`) +// /// use this method to be able to expose these inherently hot streams +// /// as `Signal`s. +// +// public func rex_toSignal() -> Signal { +// return Signal { observer in +// return self.toSignalProducer().start(observer) +// } +// } +// +// /// Converts `self` into a `Signal`, that can be used +// /// with the `takeUntil` operator, or as an "activation" signal. +// /// (e.g. a button) +// +// public final func rex_toTriggerSignal() -> Signal<(), NoError> { +// return self +// .rex_toSignal() +// .map { _ in () } +// .ignoreError() +// } +//} diff --git a/Source/Reusable.swift b/Source/Reusable.swift deleted file mode 100644 index a71197f..0000000 --- a/Source/Reusable.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// Reusable.swift -// Rex -// -// Created by David Rodrigues on 20/04/16. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import enum Result.NoError - - -/// A protocol for components that can be reused using `prepareForReuse`. -public protocol Reusable { - var rac_prepareForReuseSignal: RACSignal! { get } -} - -extension Reusable { - - /// A signal which will send a `Next` event whenever `prepareForReuse` is invoked upon - /// the receiver. - /// - /// - Note: This signal is particular useful to be used as a trigger for the `takeUntil` - /// operator. - /// - /// #### Examples - /// - /// ``` - /// button - /// .rex_controlEvents(.TouchUpInside) - /// .takeUntil(self.rex_prepareForReuse) - /// .startWithNext { _ in - /// // do other things - /// } - /// - /// label.rex_text <~ - /// titleProperty - /// .producer - /// .takeUntil(self.rex_prepareForReuse) - /// ``` - /// - public var rex_prepareForReuse: Signal { - return rac_prepareForReuseSignal - .rex_toTriggerSignal() - } -} diff --git a/Source/Signal.swift b/Source/Signal.swift index 4bc4837..f29d32b 100644 --- a/Source/Signal.swift +++ b/Source/Signal.swift @@ -6,27 +6,27 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import enum Result.NoError -extension SignalType { +extension SignalProtocol { /// Applies `transform` to values from `signal` with non-`nil` results unwrapped and /// forwared on the returned signal. - @warn_unused_result(message="Did you forget to call `observe` on the signal?") - public func filterMap(transform: Value -> U?) -> Signal { + + public func filterMap(_ transform: @escaping (Value) -> U?) -> Signal { return Signal { observer in return self.observe { event in switch event { - case let .Next(value): + case let .value(value): if let mapped = transform(value) { - observer.sendNext(mapped) + observer.send(value: mapped) } - case let .Failed(error): - observer.sendFailed(error) - case .Completed: + case let .failed(error): + observer.send(error: error) + case .completed: observer.sendCompleted() - case .Interrupted: + case .interrupted: observer.sendInterrupted() } } @@ -35,20 +35,20 @@ extension SignalType { /// Returns a signal that drops `Error` sending `replacement` terminal event /// instead, defaulting to `Completed`. - @warn_unused_result(message="Did you forget to call `observe` on the signal?") - public func ignoreError(replacement replacement: Event = .Completed) -> Signal { + + public func ignoreError(_ replacement: Event = .completed) -> Signal { precondition(replacement.isTerminating) return Signal { observer in return self.observe { event in switch event { - case let .Next(value): - observer.sendNext(value) - case .Failed: + case let .value(value): + observer.send(value: value) + case .failed: observer.action(replacement) - case .Completed: + case .completed: observer.sendCompleted() - case .Interrupted: + case .interrupted: observer.sendInterrupted() } } @@ -60,16 +60,16 @@ extension SignalType { /// /// If the interval is 0, the timeout will be scheduled immediately. The signal /// must complete synchronously (or on a faster scheduler) to avoid the timeout. - @warn_unused_result(message="Did you forget to call `observe` on the signal?") - public func timeoutAfter(interval: NSTimeInterval, withEvent event: Event, onScheduler scheduler: DateSchedulerType) -> Signal { + + public func timeoutAfter(_ interval: TimeInterval, withEvent event: Event, onScheduler scheduler: DateSchedulerProtocol) -> Signal { precondition(interval >= 0) precondition(event.isTerminating) return Signal { observer in let disposable = CompositeDisposable() - let date = scheduler.currentDate.dateByAddingTimeInterval(interval) - disposable += scheduler.scheduleAfter(date) { + let date = scheduler.currentDate.addingTimeInterval(interval) + disposable += scheduler.schedule(after: date) { observer.action(event) } @@ -85,16 +85,16 @@ extension SignalType { /// /// This operator could be used to coalesce multiple notifications in a short time /// frame by only showing the first one. - @warn_unused_result(message="Did you forget to call `observe` on the signal?") - public func muteFor(interval: NSTimeInterval, clock: DateSchedulerType) -> Signal { + + public func muteFor(_ interval: TimeInterval, clock: DateSchedulerProtocol) -> Signal { precondition(interval > 0) var expires = clock.currentDate return filter { _ in let now = clock.currentDate - if expires.compare(now) != .OrderedDescending { - expires = now.dateByAddingTimeInterval(interval) + if expires.compare(now) != .orderedDescending { + expires = now.addingTimeInterval(interval) return true } return false @@ -102,20 +102,20 @@ extension SignalType { } } -extension SignalType where Value: SequenceType { +extension SignalProtocol where Value: Sequence { /// Returns a signal that flattens sequences of elements. The inverse of `collect`. - @warn_unused_result(message="Did you forget to call `observe` on the signal?") - public func uncollect() -> Signal { - return Signal { observer in + + public func uncollect() -> Signal { + return Signal { observer in return self.observe { event in switch event { - case let .Next(sequence): - sequence.forEach { observer.sendNext($0) } - case let .Failed(error): - observer.sendFailed(error) - case .Completed: + case let .value(sequence): + sequence.forEach { observer.send(value: $0) } + case let .failed(error): + observer.send(error: error) + case .completed: observer.sendCompleted() - case .Interrupted: + case .interrupted: observer.sendInterrupted() } } diff --git a/Source/SignalProducer.swift b/Source/SignalProducer.swift index c977428..3eb8ea8 100644 --- a/Source/SignalProducer.swift +++ b/Source/SignalProducer.swift @@ -6,16 +6,16 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import enum Result.NoError -extension SignalProducerType { +extension SignalProducerProtocol { /// Buckets each received value into a group based on the key returned /// from `grouping`. Termination events on the original signal are /// also forwarded to each producer group. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public func groupBy(grouping: Value -> Key) -> SignalProducer<(Key, SignalProducer), Error> { + + public func groupBy(_ grouping: @escaping (Value) -> Key) -> SignalProducer<(Key, SignalProducer), Error> { return SignalProducer<(Key, SignalProducer), Error> { observer, disposable in var groups: [Key: Signal.Observer] = [:] @@ -24,31 +24,35 @@ extension SignalProducerType { self.start { event in switch event { - case let .Next(value): + case let .value(value): let key = grouping(value) lock.lock() var group = groups[key] if group == nil { - let (producer, innerObserver) = SignalProducer.buffer(Int.max) - observer.sendNext(key, producer) + let (signal, innerObserver) = Signal.pipe() + let producer = SignalProducer(signal: signal).replayLazily(upTo: Int.max) + + // Start the buffering immediately. + producer.start() + observer.send(value: (key, producer)) groups[key] = innerObserver group = innerObserver } lock.unlock() - group!.sendNext(value) + group!.send(value: value) - case let .Failed(error): - observer.sendFailed(error) - groups.values.forEach { $0.sendFailed(error) } + case let .failed(error): + observer.send(error: error) + groups.values.forEach { $0.send(error: error) } - case .Completed: + case .completed: observer.sendCompleted() groups.values.forEach { $0.sendCompleted() } - case .Interrupted: + case .interrupted: observer.sendInterrupted() groups.values.forEach { $0.sendInterrupted() } } @@ -58,17 +62,17 @@ extension SignalProducerType { /// Applies `transform` to values from self with non-`nil` results unwrapped and /// forwared on the returned producer. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public func filterMap(transform: Value -> U?) -> SignalProducer { + + public func filterMap(_ transform: @escaping (Value) -> U?) -> SignalProducer { return lift { $0.filterMap(transform) } } /// Returns a producer that drops `Error` sending `replacement` terminal event /// instead, defaulting to `Completed`. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public func ignoreError(replacement replacement: Event = .Completed) -> SignalProducer { + + public func ignoreError(_ replacement: Event = .completed) -> SignalProducer { precondition(replacement.isTerminating) - return lift { $0.ignoreError(replacement: replacement) } + return lift { $0.ignoreError(replacement) } } /// Forwards events from self until `interval`. Then if producer isn't completed yet, @@ -76,8 +80,8 @@ extension SignalProducerType { /// /// If the interval is 0, the timeout will be scheduled immediately. The producer /// must complete synchronously (or on a faster scheduler) to avoid the timeout. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public func timeoutAfter(interval: NSTimeInterval, withEvent event: Event, onScheduler scheduler: DateSchedulerType) -> SignalProducer { + + public func timeoutAfter(_ interval: TimeInterval, withEvent event: Event, onScheduler scheduler: DateSchedulerProtocol) -> SignalProducer { return lift { $0.timeoutAfter(interval, withEvent: event, onScheduler: scheduler) } } @@ -88,22 +92,22 @@ extension SignalProducerType { /// /// This operator could be used to coalesce multiple notifications in a short time /// frame by only showing the first one. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public func muteFor(interval: NSTimeInterval, clock: DateSchedulerType) -> SignalProducer { + + public func muteFor(_ interval: TimeInterval, clock: DateSchedulerProtocol) -> SignalProducer { return lift { $0.muteFor(interval, clock: clock) } } /// Delays the start of the producer by `interval` on the provided scheduler. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public func deferred(interval: NSTimeInterval, onScheduler scheduler: DateSchedulerType) -> SignalProducer { + + public func deferred(_ interval: TimeInterval, onScheduler scheduler: DateSchedulerProtocol) -> SignalProducer { return SignalProducer.empty - .delay(interval, onScheduler: scheduler) + .delay(interval, on: scheduler) .concat(self.producer) } /// Delays retrying on failure by `interval` up to `count` attempts. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public func deferredRetry(interval: NSTimeInterval, onScheduler scheduler: DateSchedulerType, count: Int = .max) -> SignalProducer { + + public func deferredRetry(_ interval: TimeInterval, onScheduler scheduler: DateSchedulerProtocol, count: Int = .max) -> SignalProducer { precondition(count >= 0) if count == 0 { @@ -121,14 +125,14 @@ extension SignalProducerType { retries -= 1 return producer } - .retry(count) + .retry(upTo: count) } } -extension SignalProducerType where Value: SequenceType { +extension SignalProducerProtocol where Value: Sequence { /// Returns a producer that flattens sequences of elements. The inverse of `collect`. - @warn_unused_result(message="Did you forget to call `start` on the producer?") - public func uncollect() -> SignalProducer { + + public func uncollect() -> SignalProducer { return lift { $0.uncollect() } } } diff --git a/Source/UIKit/UIActivityIndicatorView.swift b/Source/UIKit/UIActivityIndicatorView.swift deleted file mode 100644 index 179b795..0000000 --- a/Source/UIKit/UIActivityIndicatorView.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// UIActivityIndicatorView.swift -// Rex -// -// Created by Evgeny Kazakov on 02/07/16. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UIActivityIndicatorView { - - /// Wraps an indicator's `isAnimating()` state in a bindable property. - /// Setting a new value to the property would call `startAnimating()` or - /// `stopAnimating()` depending on the value. - public var rex_animating: MutableProperty { - return associatedProperty(self, key: &animatingKey, initial: { $0.isAnimating() }, setter: { host, animating in - if animating { - host.startAnimating() - } else { - host.stopAnimating() - } - }) - } - -} - -private var animatingKey: UInt8 = 0 diff --git a/Source/UIKit/UIBarButtonItem.swift b/Source/UIKit/UIBarButtonItem.swift deleted file mode 100644 index 25a05c5..0000000 --- a/Source/UIKit/UIBarButtonItem.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// UIBarButtonItem.swift -// Rex -// -// Created by Bjarke Hesthaven Søndergaard on 24/07/15. -// Copyright (c) 2015 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UIBarButtonItem { - /// Exposes a property that binds an action to bar button item. The action is set as - /// a target of the button. When property changes occur the previous action is - /// overwritten. This also binds the enabled state of the action to the `rex_enabled` - /// property on the button. - public var rex_action: MutableProperty { - return associatedObject(self, key: &actionKey) { host in - let initial = CocoaAction.rex_disabled - let property = MutableProperty(initial) - - property.producer - .startWithNext { [weak host] action in - host?.target = action - host?.action = CocoaAction.selector - } - - host.rex_enabled <~ property.producer.flatMap(.Latest) { $0.rex_enabledProducer } - - return property - } - } -} - -private var actionKey: UInt8 = 0 diff --git a/Source/UIKit/UIBarItem.swift b/Source/UIKit/UIBarItem.swift deleted file mode 100644 index 999bd94..0000000 --- a/Source/UIKit/UIBarItem.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// UIBarItem.swift -// Rex -// -// Created by Bjarke Hesthaven Søndergaard on 24/07/15. -// Copyright (c) 2015 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UIBarItem { - /// Wraps a UIBarItem's `enabled` state in a bindable property. - public var rex_enabled: MutableProperty { - return associatedProperty(self, key: &enabledKey, initial: { $0.enabled }, setter: { $0.enabled = $1 }) - } -} - -private var enabledKey: UInt8 = 0 diff --git a/Source/UIKit/UIButton.swift b/Source/UIKit/UIButton.swift deleted file mode 100644 index ea49aef..0000000 --- a/Source/UIKit/UIButton.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// UIButton.swift -// Rex -// -// Created by Neil Pankey on 6/19/15. -// Copyright (c) 2015 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UIButton { - /// Exposes a property that binds an action to button presses. The action is set as - /// a target of the button for `TouchUpInside` events. When property changes occur the - /// previous action is removed as a target. This also binds the enabled state of the - /// action to the `rex_enabled` property on the button. - public var rex_pressed: MutableProperty { - return associatedObject(self, key: &pressedKey) { host in - let initial = CocoaAction.rex_disabled - let property = MutableProperty(initial) - - property.producer - .combinePrevious(initial) - .startWithNext { [weak host] previous, next in - host?.removeTarget(previous, action: CocoaAction.selector, forControlEvents: .TouchUpInside) - host?.addTarget(next, action: CocoaAction.selector, forControlEvents: .TouchUpInside) - } - - host.rex_enabled <~ property.producer.flatMap(.Latest) { $0.rex_enabledProducer } - - return property - } - } - - /// Wraps a button's `title` text in a bindable property. Note that this only applies - /// to `UIControlState.Normal`. - public var rex_title: MutableProperty { - return associatedProperty(self, key: &titleKey, initial: { $0.titleForState(.Normal) ?? "" }, setter: { $0.setTitle($1, forState: .Normal) }) - } -} - -private var pressedKey: UInt8 = 0 -private var titleKey: UInt8 = 0 diff --git a/Source/UIKit/UICollectionReusableView.swift b/Source/UIKit/UICollectionReusableView.swift deleted file mode 100644 index 827b6e5..0000000 --- a/Source/UIKit/UICollectionReusableView.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// UICollectionReusableView.swift -// Rex -// -// Created by David Rodrigues on 20/04/16. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import UIKit - -extension UICollectionReusableView: Reusable {} diff --git a/Source/UIKit/UIControl.swift b/Source/UIKit/UIControl.swift index 1ad6e9a..9f114a3 100644 --- a/Source/UIKit/UIControl.swift +++ b/Source/UIKit/UIControl.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import UIKit import enum Result.NoError @@ -14,47 +14,24 @@ extension UIControl { #if os(iOS) /// Creates a producer for the sender whenever a specified control event is triggered. - @warn_unused_result(message="Did you forget to use the property?") - public func rex_controlEvents(events: UIControlEvents) -> SignalProducer { - return rac_signalForControlEvents(events) - .toSignalProducer() - .map { $0 as? UIControl } - .flatMapError { _ in SignalProducer(value: nil) } + private func _rex_controlEvents(events: UIControlEvents) -> Signal { + return reactive.trigger(for: events) + .map { [weak self] _ in return self } } - /// Creates a bindable property to wrap a control's value. /// /// This property uses `UIControlEvents.ValueChanged` and `UIControlEvents.EditingChanged` /// events to detect changes and keep the value up-to-date. // - @warn_unused_result(message="Did you forget to use the property?") - class func rex_value(host: Host, getter: Host -> T, setter: (Host, T) -> ()) -> MutableProperty { + class func rex_value(host: Host, getter: @escaping (Host) -> T, setter: @escaping (Host, T) -> ()) -> MutableProperty { return associatedProperty(host, key: &valueChangedKey, initial: getter, setter: setter) { property in property <~ - host.rex_controlEvents([.ValueChanged, .EditingChanged]) + host._rex_controlEvents(events: [.valueChanged, .editingChanged]) .filterMap { $0 as? Host } .filterMap(getter) } } #endif - - /// Wraps a control's `enabled` state in a bindable property. - public var rex_enabled: MutableProperty { - return associatedProperty(self, key: &enabledKey, initial: { $0.enabled }, setter: { $0.enabled = $1 }) - } - - /// Wraps a control's `selected` state in a bindable property. - public var rex_selected: MutableProperty { - return associatedProperty(self, key: &selectedKey, initial: { $0.selected }, setter: { $0.selected = $1 }) - } - - /// Wraps a control's `highlighted` state in a bindable property. - public var rex_highlighted: MutableProperty { - return associatedProperty(self, key: &highlightedKey, initial: { $0.highlighted }, setter: { $0.highlighted = $1 }) - } } -private var enabledKey: UInt8 = 0 -private var selectedKey: UInt8 = 0 -private var highlightedKey: UInt8 = 0 private var valueChangedKey: UInt8 = 0 diff --git a/Source/UIKit/UIDatePicker.swift b/Source/UIKit/UIDatePicker.swift deleted file mode 100644 index 75f0d38..0000000 --- a/Source/UIKit/UIDatePicker.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// UIDatePicker.swift -// Rex -// -// Created by Guido Marucci Blas on 3/25/16. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UIDatePicker { - - // Wraps a datePicker's `date` value in a bindable property. - public var rex_date: MutableProperty { - return UIControl.rex_value(self, getter: { $0.date }, setter: { $0.date = $1 }) - } -} diff --git a/Source/UIKit/UIImageView.swift b/Source/UIKit/UIImageView.swift deleted file mode 100644 index db6d09e..0000000 --- a/Source/UIKit/UIImageView.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// UIImageView.swift -// Rex -// -// Created by Andy Jacobs on 21/10/15. -// Copyright © 2015 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UIImageView { - /// Wraps a imageView's `image` value in a bindable property. - public var rex_image: MutableProperty { - return associatedProperty(self, key: &imageKey, initial: { $0.image }, setter: { $0.image = $1 }) - } - - /// Wraps a imageView's `highlightedImage` value in a bindable property. - public var rex_highlightedImage: MutableProperty { - return associatedProperty(self, key: &highlightedImageKey, initial: { $0.highlightedImage }, setter: { $0.highlightedImage = $1 }) - } -} - -private var imageKey: UInt8 = 0 -private var highlightedImageKey: UInt8 = 0 diff --git a/Source/UIKit/UILabel.swift b/Source/UIKit/UILabel.swift deleted file mode 100644 index ab61ef1..0000000 --- a/Source/UIKit/UILabel.swift +++ /dev/null @@ -1,31 +0,0 @@ -// -// UILabel.swift -// Rex -// -// Created by Neil Pankey on 6/19/15. -// Copyright (c) 2015 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UILabel { - /// Wraps a label's `text` value in a bindable property. - public var rex_text: MutableProperty { - return associatedProperty(self, key: &textKey, initial: { $0.text }, setter: { $0.text = $1 }) - } - - /// Wraps a label's `attributedText` value in a bindable property. - public var rex_attributedText: MutableProperty { - return associatedProperty(self, key: &attributedTextKey, initial: { $0.attributedText }, setter: { $0.attributedText = $1 }) - } - - /// Wraps a label's `textColor` value in a bindable property. - public var rex_textColor: MutableProperty { - return associatedProperty(self, key: &textColorKey, initial: { $0.textColor }, setter: { $0.textColor = $1 }) - } -} - -private var textKey: UInt8 = 0 -private var attributedTextKey: UInt8 = 0 -private var textColorKey: UInt8 = 0 diff --git a/Source/UIKit/UIProgressView.swift b/Source/UIKit/UIProgressView.swift deleted file mode 100644 index 52119d4..0000000 --- a/Source/UIKit/UIProgressView.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// UIProgressView.swift -// Rex -// -// Created by Tomi Pajunen on 04/05/16. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UIProgressView { - /// Wraps a progressView's `progress` value in a bindable property. - public var rex_progress: MutableProperty { - return associatedProperty(self, key: &progressKey, initial: { $0.progress }, setter: { $0.progress = $1 }) - } -} - -private var progressKey: UInt8 = 0 \ No newline at end of file diff --git a/Source/UIKit/UISegmentedControl.swift b/Source/UIKit/UISegmentedControl.swift deleted file mode 100644 index 465c76e..0000000 --- a/Source/UIKit/UISegmentedControl.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// UISegmentedControl.swift -// Rex -// -// Created by Markus Chmelar on 07/06/16. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UISegmentedControl { - /// Wraps a segmentedControls `selectedSegmentIndex` state in a bindable property. - public var rex_selectedSegmentIndex: MutableProperty { - let property = associatedProperty(self, key: &selectedSegmentIndexKey, initial: { $0.selectedSegmentIndex }, setter: { $0.selectedSegmentIndex = $1 }) - property <~ rex_controlEvents(.ValueChanged) - .filterMap { ($0 as? UISegmentedControl)?.selectedSegmentIndex } - return property - } -} - -private var selectedSegmentIndexKey: UInt8 = 0 diff --git a/Source/UIKit/UISwitch.swift b/Source/UIKit/UISwitch.swift deleted file mode 100644 index e02c890..0000000 --- a/Source/UIKit/UISwitch.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// UISwitch.swift -// Rex -// -// Created by David Rodrigues on 07/04/16. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UISwitch { - - /// Wraps a switch's `on` value in a bindable property. - public var rex_on: MutableProperty { - return UIControl.rex_value(self, getter: { $0.on }, setter: { $0.on = $1 }) - } -} diff --git a/Source/UIKit/UITableViewCell.swift b/Source/UIKit/UITableViewCell.swift deleted file mode 100644 index 122df01..0000000 --- a/Source/UIKit/UITableViewCell.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// UITableViewCell.swift -// Rex -// -// Created by David Rodrigues on 19/04/16. -// modified by Andrew Ware on 6/7/16. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UITableViewCell: Reusable {} diff --git a/Source/UIKit/UITableViewHeaderFooterView.swift b/Source/UIKit/UITableViewHeaderFooterView.swift deleted file mode 100644 index d013da0..0000000 --- a/Source/UIKit/UITableViewHeaderFooterView.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// UITableViewHeaderFooterView.swift -// Rex -// -// Created by David Rodrigues on 19/04/16. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import UIKit - -extension UITableViewHeaderFooterView: Reusable {} diff --git a/Source/UIKit/UITextField.swift b/Source/UIKit/UITextField.swift deleted file mode 100644 index c9fa38c..0000000 --- a/Source/UIKit/UITextField.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// UITextField.swift -// Rex -// -// Created by Rui Peres on 17/01/2016. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UITextField { - - /// Wraps a textField's `text` value in a bindable property. - public var rex_text: MutableProperty { - let getter: UITextField -> String? = { $0.text } - let setter: (UITextField, String?) -> () = { $0.text = $1 } -#if os(iOS) - return UIControl.rex_value(self, getter: getter, setter: setter) -#else - return associatedProperty(self, key: &textKey, initial: getter, setter: setter) { property in - property <~ - NSNotificationCenter.defaultCenter() - .rac_notifications(UITextFieldTextDidChangeNotification, object: self) - .filterMap { ($0.object as? UITextField)?.text } - } -#endif - } - -} - -private var textKey: UInt8 = 0 diff --git a/Source/UIKit/UITextView.swift b/Source/UIKit/UITextView.swift deleted file mode 100644 index 95a9b19..0000000 --- a/Source/UIKit/UITextView.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// UITextView.swift -// Rex -// -// Created by Rui Peres on 05/04/2016. -// Copyright © 2016 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit -import enum Result.NoError - -extension UITextView { - - /// Sends the textView's string value whenever it changes. - public var rex_text: SignalProducer { - return NSNotificationCenter.defaultCenter() - .rac_notifications(UITextViewTextDidChangeNotification, object: self) - .filterMap { ($0.object as? UITextView)?.text } - } -} diff --git a/Source/UIKit/UIView.swift b/Source/UIKit/UIView.swift deleted file mode 100644 index f0a67f7..0000000 --- a/Source/UIKit/UIView.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// UIView.swift -// Rex -// -// Created by Andy Jacobs on 21/10/15. -// Copyright © 2015 Neil Pankey. All rights reserved. -// - -import ReactiveCocoa -import UIKit - -extension UIView { - /// Wraps a view's `alpha` value in a bindable property. - public var rex_alpha: MutableProperty { - return associatedProperty(self, key: &alphaKey, initial: { $0.alpha }, setter: { $0.alpha = $1 }) - } - - /// Wraps a view's `hidden` state in a bindable property. - public var rex_hidden: MutableProperty { - return associatedProperty(self, key: &hiddenKey, initial: { $0.hidden }, setter: { $0.hidden = $1 }) - } - - - /// Wraps a view's `userInteractionEnabled` state in a bindable property. - public var rex_userInteractionEnabled: MutableProperty { - return associatedProperty(self, key: &userInteractionEnabledKey, initial: { $0.userInteractionEnabled }, setter: { $0.userInteractionEnabled = $1 }) - } -} - -private var alphaKey: UInt8 = 0 -private var hiddenKey: UInt8 = 0 -private var userInteractionEnabledKey: UInt8 = 0 diff --git a/Source/UIKit/UIViewController.swift b/Source/UIKit/UIViewController.swift index f16264b..c35b4ae 100644 --- a/Source/UIKit/UIViewController.swift +++ b/Source/UIKit/UIViewController.swift @@ -7,41 +7,35 @@ // import Result -import ReactiveCocoa +import ReactiveSwift import UIKit extension UIViewController { /// Returns a `Signal`, that will be triggered /// when `self`'s `viewDidDisappear` is called public var rex_viewDidDisappear: Signal<(), NoError> { - return triggerForSelector(#selector(UIViewController.viewDidDisappear(_:))) + return reactive.trigger(for: #selector(UIViewController.viewDidDisappear(_:))) } /// Returns a `Signal`, that will be triggered /// when `self`'s `viewWillDisappear` is called public var rex_viewWillDisappear: Signal<(), NoError> { - return triggerForSelector(#selector(UIViewController.viewWillDisappear(_:))) + return reactive.trigger(for: #selector(UIViewController.viewWillDisappear(_:))) } /// Returns a `Signal`, that will be triggered /// when `self`'s `viewDidAppear` is called public var rex_viewDidAppear: Signal<(), NoError> { - return triggerForSelector(#selector(UIViewController.viewDidAppear(_:))) + return reactive.trigger(for: #selector(UIViewController.viewDidAppear(_:))) } /// Returns a `Signal`, that will be triggered /// when `self`'s `viewWillAppear` is called public var rex_viewWillAppear: Signal<(), NoError> { - return triggerForSelector(#selector(UIViewController.viewWillAppear(_:))) + return reactive.trigger(for: #selector(UIViewController.viewWillAppear(_:))) } - private func triggerForSelector(selector: Selector) -> Signal<(), NoError> { - return self - .rac_signalForSelector(selector) - .rex_toTriggerSignal() - } - - public typealias DismissingCompletion = (Void -> Void)? + public typealias DismissingCompletion = ((Void) -> Void)? public typealias DismissingInformation = (animated: Bool, completion: DismissingCompletion)? /// Wraps a viewController's `dismissViewControllerAnimated` function in a bindable property. @@ -56,17 +50,16 @@ extension UIViewController { /// or `viewController.dismissViewControllerAnimated(true, completion: nil)` public var rex_dismissAnimated: MutableProperty { - let initial: UIViewController -> DismissingInformation = { _ in nil } + let initial: (UIViewController) -> DismissingInformation = { _ in nil } let setter: (UIViewController, DismissingInformation) -> Void = { host, dismissingInfo in guard let unwrapped = dismissingInfo else { return } - host.dismissViewControllerAnimated(unwrapped.animated, completion: unwrapped.completion) + host.dismiss(animated: unwrapped.animated, completion: unwrapped.completion) } - + let property = associatedProperty(self, key: &dismissModally, initial: initial, setter: setter) { property in - property <~ self.rac_signalForSelector(#selector(UIViewController.dismissViewControllerAnimated(_:completion:))) - .takeUntilBlock { _ in property.value != nil } - .rex_toTriggerSignal() + property <~ self.reactive.trigger(for: #selector(UIViewController.dismiss(animated:completion:))) + .take(while: { _ in property.value == nil }) .map { _ in return nil } } diff --git a/Tests/ActionTests.swift b/Tests/ActionTests.swift index abd4d1c..27189c1 100644 --- a/Tests/ActionTests.swift +++ b/Tests/ActionTests.swift @@ -7,14 +7,14 @@ // @testable import Rex -import ReactiveCocoa +import ReactiveSwift import XCTest import enum Result.NoError final class ActionTests: XCTestCase { - enum TestError: ErrorType { - case Unknown + enum TestError: Error { + case unknown } func testStarted() { @@ -23,7 +23,7 @@ final class ActionTests: XCTestCase { var started = false action .rex_started - .observeNext { started = true } + .observeValues { started = true } action .apply() @@ -33,19 +33,20 @@ final class ActionTests: XCTestCase { } func testCompleted() { - let (producer, observer) = SignalProducer.buffer(Int.max) + let (signal, observer) = Signal.pipe() + let producer = SignalProducer(signal: signal) let action = Action { producer } var completed = false action .rex_completed - .observeNext { completed = true } + .observeValues { completed = true } action .apply() .start() - observer.sendNext(1) + observer.send(value: 1) XCTAssertFalse(completed) observer.sendCompleted() @@ -53,19 +54,20 @@ final class ActionTests: XCTestCase { } func testCompletedOnFailed() { - let (producer, observer) = SignalProducer.buffer(Int.max) + let (signal, observer) = Signal.pipe() + let producer = SignalProducer(signal: signal) let action = Action { producer } var completed = false action .rex_completed - .observeNext { completed = true } + .observeValues { completed = true } action .apply() .start() - observer.sendFailed(.Unknown) + observer.send(error: .unknown) XCTAssertFalse(completed) } } diff --git a/Tests/Foundation/NSObjectTests.swift b/Tests/Foundation/NSObjectTests.swift index 5ffc070..38a9701 100644 --- a/Tests/Foundation/NSObjectTests.swift +++ b/Tests/Foundation/NSObjectTests.swift @@ -7,7 +7,7 @@ // import Rex -import ReactiveCocoa +import ReactiveSwift import XCTest final class NSObjectTests: XCTestCase { @@ -16,7 +16,7 @@ final class NSObjectTests: XCTestCase { let object = Object() var value: String = "" - object.rex_producerForKeyPath("string").startWithNext { value = $0 } + object.reactive.values(forKeyPath: "string").startWithValues { value = $0 as! String } XCTAssertEqual(value, "foo") object.string = "bar" @@ -25,13 +25,13 @@ final class NSObjectTests: XCTestCase { func testObjectsWillBeDeallocatedSignal() { - let expectation = self.expectationWithDescription("Expected timer to send `completed` event when object deallocates") - defer { self.waitForExpectationsWithTimeout(2, handler: nil) } + let expectation = self.expectation(description: "Expected timer to send `completed` event when object deallocates") + defer { self.waitForExpectations(timeout: 2, handler: nil) } let object = Object() - timer(1, onScheduler: QueueScheduler(name: "test.queue")) - .takeUntil(object.rex_willDealloc) + timer(interval: 1, on: QueueScheduler(name: "test.queue")) + .take(until: object.reactive.lifetime.ended) .startWithCompleted { expectation.fulfill() } @@ -55,13 +55,12 @@ final class NSObjectDeallocTests: XCTestCase { XCTAssert(_object?.string == "Test") } - func testClassPropertyDoesntCreateRetainCycle() { - let object = Object() - _object = object - - associatedProperty(object, keyPath: "string", placeholder: { _ in "" }) <~ SignalProducer(value: "Test") - XCTAssert(_object?.string == "Test") - } +// func testClassPropertyDoesntCreateRetainCycle() { +// let object = Object() +// _object = object +// associatedProperty(object, keyPath: "string", placeholder: { _ in "" }) <~ SignalProducer(value: "Test") +// XCTAssert(_object?.string == "Test") +// } } class Object: NSObject { diff --git a/Tests/Helpers/UIControl+EnableSendActionsForControlEvents.swift b/Tests/Helpers/UIControl+EnableSendActionsForControlEvents.swift index 24d5db1..eb9b9f1 100644 --- a/Tests/Helpers/UIControl+EnableSendActionsForControlEvents.swift +++ b/Tests/Helpers/UIControl+EnableSendActionsForControlEvents.swift @@ -13,45 +13,39 @@ import UIKit /// want test our bindings for `UIDatePicker`, `UISwitch`, `UITextField` and others /// in the future. To be able to test them, we're now using swizzling to manually invoke /// the pair target+action. -extension UIControl { - - public override class func initialize() { - - struct Static { - static var token: dispatch_once_t = 0 - } - - if self !== UIControl.self { - return - } - - dispatch_once(&Static.token) { - - let originalSelector = #selector(UIControl.sendAction(_:to:forEvent:)) - let swizzledSelector = #selector(UIControl.rex_sendAction(_:to:forEvent:)) - - let originalMethod = class_getInstanceMethod(self, originalSelector) - let swizzledMethod = class_getInstanceMethod(self, swizzledSelector) - - let didAddMethod = class_addMethod(self, - originalSelector, - method_getImplementation(swizzledMethod), - method_getTypeEncoding(swizzledMethod)) - - if didAddMethod { - class_replaceMethod(self, - swizzledSelector, - method_getImplementation(originalMethod), - method_getTypeEncoding(originalMethod)) - } else { - method_exchangeImplementations(originalMethod, swizzledMethod) - } - } +fileprivate let swizzling: (UIControl.Type) -> () = { control in + let originalSelector = #selector(control.sendAction(_:to:for:)) + let swizzledSelector = #selector(control.rex_sendAction(_:to:forEvent:)) + + let originalMethod = class_getInstanceMethod(control, originalSelector) + let swizzledMethod = class_getInstanceMethod(control, swizzledSelector) + + let didAddMethod = class_addMethod(control, + originalSelector, + method_getImplementation(swizzledMethod), + method_getTypeEncoding(swizzledMethod)) + + if didAddMethod { + class_replaceMethod(control, + swizzledSelector, + method_getImplementation(originalMethod), + method_getTypeEncoding(originalMethod)) + } else { + method_exchangeImplementations(originalMethod, swizzledMethod) } +} +extension UIControl { + + open override class func initialize() { + // make sure this isn't a subclass + guard self === UIControl.self else { return } + swizzling(self) + } + // MARK: - Method Swizzling - - func rex_sendAction(action: Selector, to target: AnyObject?, forEvent event: UIEvent?) { - target?.performSelector(action, withObject: self) + + func rex_sendAction(_ action: Selector, to target: AnyObject?, forEvent event: UIEvent?) { + _ = target?.perform(action, with: self) } } diff --git a/Tests/PropertyTests.swift b/Tests/PropertyTests.swift index ea32ccb..436386b 100644 --- a/Tests/PropertyTests.swift +++ b/Tests/PropertyTests.swift @@ -7,7 +7,7 @@ // @testable import Rex -import ReactiveCocoa +import ReactiveSwift import XCTest import enum Result.NoError @@ -18,7 +18,7 @@ final class PropertyTests: XCTestCase { let and = lhs.and(rhs) var current: Bool! - and.producer.startWithNext { current = $0 } + and.producer.startWithValues { current = $0 } XCTAssertFalse(and.value) XCTAssertFalse(current!) @@ -32,13 +32,13 @@ final class PropertyTests: XCTestCase { XCTAssertTrue(current!) let (signal, pipe) = Signal.pipe() - let and2 = and.and(AnyProperty(initialValue: false, signal: signal)) - and2.producer.startWithNext { current = $0 } + let and2 = and.and(Property(initial: false, then: signal)) + and2.producer.startWithValues { current = $0 } XCTAssertFalse(and2.value) XCTAssertFalse(current!) - pipe.sendNext(true) + pipe.send(value: true) XCTAssertTrue(and2.value) XCTAssertTrue(current!) } @@ -48,7 +48,7 @@ final class PropertyTests: XCTestCase { let or = lhs.or(rhs) var current: Bool! - or.producer.startWithNext { current = $0 } + or.producer.startWithValues { current = $0 } XCTAssertTrue(or.value) XCTAssertTrue(current!) @@ -62,13 +62,13 @@ final class PropertyTests: XCTestCase { XCTAssertFalse(current!) let (signal, pipe) = Signal.pipe() - let or2 = or.or(AnyProperty(initialValue: true, signal: signal)) - or2.producer.startWithNext { current = $0 } + let or2 = or.or(Property(initial: true, then: signal)) + or2.producer.startWithValues { current = $0 } XCTAssertTrue(or2.value) XCTAssertTrue(current!) - pipe.sendNext(false) + pipe.send(value: false) XCTAssertFalse(or2.value) XCTAssertFalse(current!) } @@ -78,7 +78,7 @@ final class PropertyTests: XCTestCase { let not = source.not() var current: Bool! - not.producer.startWithNext { current = $0 } + not.producer.startWithValues { current = $0 } XCTAssertTrue(not.value) XCTAssertTrue(current!) diff --git a/Tests/SignalProducerTests.swift b/Tests/SignalProducerTests.swift index 35ef801..82d64cd 100644 --- a/Tests/SignalProducerTests.swift +++ b/Tests/SignalProducerTests.swift @@ -7,14 +7,15 @@ // import Rex -import ReactiveCocoa +import ReactiveSwift import XCTest import enum Result.NoError final class SignalProducerTests: XCTestCase { func testGroupBy() { - let (producer, observer) = SignalProducer.buffer(Int.max) + let (signal, observer) = Signal.pipe() + let producer = SignalProducer(signal: signal) var evens: [Int] = [] var odds: [Int] = [] let disposable = CompositeDisposable() @@ -23,11 +24,11 @@ final class SignalProducerTests: XCTestCase { disposable += producer .groupBy { $0 % 2 == 0 } - .start(Observer(next: { key, group in + .start(Observer(value: { key, group in if key { - group.startWithNext { evens.append($0) } + group.startWithValues { evens.append($0) } } else { - group.startWithNext { odds.append($0) } + group.startWithValues { odds.append($0) } } },completed: { completed = true @@ -35,21 +36,21 @@ final class SignalProducerTests: XCTestCase { interrupted = true })) - observer.sendNext(1) + observer.send(value: 1) XCTAssert(evens == []) XCTAssert(odds == [1]) - observer.sendNext(2) + observer.send(value: 2) XCTAssert(evens == [2]) XCTAssert(odds == [1]) - observer.sendNext(3) + observer.send(value: 3) XCTAssert(evens == [2]) XCTAssert(odds == [1, 3]) disposable.dispose() - observer.sendNext(1) + observer.send(value: 1) XCTAssert(interrupted) XCTAssertFalse(completed) } @@ -72,10 +73,10 @@ final class SignalProducerTests: XCTestCase { scheduler.advance() XCTAssertFalse(deferred) - scheduler.advanceByInterval(0.9) + scheduler.advance(by: 0.9) XCTAssertFalse(deferred) - scheduler.advanceByInterval(0.2) + scheduler.advance(by: 0.2) XCTAssertTrue(deferred) } @@ -85,8 +86,8 @@ final class SignalProducerTests: XCTestCase { var count = 0 let producer = SignalProducer { observer, _ in if count < 2 { - scheduler.schedule { observer.sendNext(count) } - scheduler.schedule { observer.sendFailed(.Default) } + scheduler.schedule { observer.send(value: count) } + scheduler.schedule { observer.send(error: .default) } } else { scheduler.schedule { observer.sendCompleted() } } @@ -98,7 +99,7 @@ final class SignalProducerTests: XCTestCase { producer .deferredRetry(1, onScheduler: scheduler) .start(Observer( - next: { value = $0 }, + value: { value = $0 }, completed: { completed = true } )) @@ -110,12 +111,12 @@ final class SignalProducerTests: XCTestCase { XCTAssertEqual(value, 1) XCTAssertFalse(completed) - scheduler.advanceByInterval(1) + scheduler.advance(by: 1) XCTAssertEqual(count, 2) XCTAssertEqual(value, 2) XCTAssertFalse(completed) - scheduler.advanceByInterval(1) + scheduler.advance(by: 1) XCTAssertEqual(count, 3) XCTAssertEqual(value, 2) XCTAssertTrue(completed) @@ -126,8 +127,8 @@ final class SignalProducerTests: XCTestCase { var count = 0 let producer = SignalProducer { observer, _ in - observer.sendNext(count) - observer.sendFailed(.Default) + observer.send(value: count) + observer.send(error: .default) count += 1 } @@ -136,7 +137,7 @@ final class SignalProducerTests: XCTestCase { producer .deferredRetry(1, onScheduler: scheduler, count: 2) .start(Observer( - next: { value = $0 }, + value: { value = $0 }, failed: { _ in failed = true } )) @@ -148,12 +149,12 @@ final class SignalProducerTests: XCTestCase { XCTAssertEqual(value, 0) XCTAssertFalse(failed) - scheduler.advanceByInterval(1) + scheduler.advance(by: 1) XCTAssertEqual(count, 2) XCTAssertEqual(value, 1) XCTAssertFalse(failed) - scheduler.advanceByInterval(1) + scheduler.advance(by: 1) XCTAssertEqual(count, 3) XCTAssertEqual(value, 2) XCTAssertTrue(failed) diff --git a/Tests/SignalTests.swift b/Tests/SignalTests.swift index af55e1b..527800d 100644 --- a/Tests/SignalTests.swift +++ b/Tests/SignalTests.swift @@ -7,7 +7,7 @@ // import Rex -import ReactiveCocoa +import ReactiveSwift import XCTest import enum Result.NoError @@ -21,18 +21,18 @@ final class SignalTests: XCTestCase { .filterMap { return $0 % 2 == 0 ? String($0) : nil } - .observeNext { values.append($0) } + .observeValues { values.append($0) } - observer.sendNext(1) + observer.send(value: 1) XCTAssert(values == []) - observer.sendNext(2) + observer.send(value: 2) XCTAssert(values == ["2"]) - observer.sendNext(3) + observer.send(value: 3) XCTAssert(values == ["2"]) - observer.sendNext(6) + observer.send(value: 6) XCTAssert(values == ["2", "6"]) } @@ -44,10 +44,10 @@ final class SignalTests: XCTestCase { .ignoreError() .observeCompleted { completed = true } - observer.sendNext(1) + observer.send(value: 1) XCTAssertFalse(completed) - observer.sendFailed(.Default) + observer.send(error: .default) XCTAssertTrue(completed) } @@ -56,13 +56,13 @@ final class SignalTests: XCTestCase { var interrupted = false signal - .ignoreError(replacement: .Interrupted) + .ignoreError(.interrupted) .observeInterrupted { interrupted = true } - observer.sendNext(1) + observer.send(value: 1) XCTAssertFalse(interrupted) - observer.sendFailed(.Default) + observer.send(error: .default) XCTAssertTrue(interrupted) } @@ -73,13 +73,12 @@ final class SignalTests: XCTestCase { var completed = false signal - .timeoutAfter(2, withEvent: .Interrupted, onScheduler: scheduler) + .timeoutAfter(2, withEvent: .interrupted, onScheduler: scheduler) .observe(Observer( completed: { completed = true }, interrupted: { interrupted = true } )) - - scheduler.scheduleAfter(1) { observer.sendCompleted() } + scheduler.schedule(after: 1) { observer.sendCompleted() } XCTAssertFalse(interrupted) XCTAssertFalse(completed) @@ -96,13 +95,13 @@ final class SignalTests: XCTestCase { var completed = false signal - .timeoutAfter(2, withEvent: .Interrupted, onScheduler: scheduler) + .timeoutAfter(2, withEvent: .interrupted, onScheduler: scheduler) .observe(Observer( completed: { completed = true }, interrupted: { interrupted = true } )) - scheduler.scheduleAfter(3) { observer.sendCompleted() } + scheduler.schedule(after: 3) { observer.sendCompleted() } XCTAssertFalse(interrupted) XCTAssertFalse(completed) @@ -118,15 +117,15 @@ final class SignalTests: XCTestCase { signal .uncollect() - .observeNext { values.append($0) } + .observeValues { values.append($0) } - observer.sendNext([]) + observer.send(value: []) XCTAssert(values.isEmpty) - observer.sendNext([1]) + observer.send(value: [1]) XCTAssert(values == [1]) - observer.sendNext([2, 3]) + observer.send(value: [2, 3]) XCTAssert(values == [1, 2, 3]) } @@ -137,26 +136,26 @@ final class SignalTests: XCTestCase { signal .muteFor(1, clock: scheduler) - .observeNext { value = $0 } + .observeValues { value = $0 } - scheduler.schedule { observer.sendNext(1) } + scheduler.schedule { observer.send(value: 1) } scheduler.advance() XCTAssertEqual(value, 1) - scheduler.schedule { observer.sendNext(2) } + scheduler.schedule { observer.send(value: 2) } scheduler.advance() XCTAssertEqual(value, 1) - scheduler.schedule { observer.sendNext(3) } - scheduler.schedule { observer.sendNext(4) } + scheduler.schedule { observer.send(value: 3) } + scheduler.schedule { observer.send(value: 4) } scheduler.advance() XCTAssertEqual(value, 1) - scheduler.advanceByInterval(1) + scheduler.advance(by: 1) XCTAssertEqual(value, 1) - scheduler.schedule { observer.sendNext(5) } - scheduler.schedule { observer.sendNext(6) } + scheduler.schedule { observer.send(value: 5) } + scheduler.schedule { observer.send(value: 6) } scheduler.advance() XCTAssertEqual(value, 5) } @@ -170,22 +169,22 @@ final class SignalTests: XCTestCase { signal .muteFor(1, clock: scheduler) .observe(Observer( - next: { value = $0 }, + value: { value = $0 }, failed: { _ in failed = true } )) - scheduler.schedule { observer.sendNext(1) } + scheduler.schedule { observer.send(value: 1) } scheduler.advance() XCTAssertEqual(value, 1) - scheduler.schedule { observer.sendNext(2) } - scheduler.schedule { observer.sendFailed(.Default) } + scheduler.schedule { observer.send(value: 2) } + scheduler.schedule { observer.send(error: .default) } scheduler.advance() XCTAssertTrue(failed) XCTAssertEqual(value, 1) } } -enum TestError: ErrorType { - case Default +enum TestError: Error { + case `default` } diff --git a/Tests/UIKit/UIActivityIndicatorViewTests.swift b/Tests/UIKit/UIActivityIndicatorViewTests.swift index d47d1cb..451a04b 100644 --- a/Tests/UIKit/UIActivityIndicatorViewTests.swift +++ b/Tests/UIKit/UIActivityIndicatorViewTests.swift @@ -7,7 +7,7 @@ // import XCTest -import ReactiveCocoa +import ReactiveSwift import Result class UIActivityIndicatorTests: XCTestCase { @@ -20,15 +20,15 @@ class UIActivityIndicatorTests: XCTestCase { } func testAnimatingProperty() { - let indicatorView = UIActivityIndicatorView(frame: CGRectZero) + let indicatorView = UIActivityIndicatorView(frame: .zero) _activityIndicatorView = indicatorView let (pipeSignal, observer) = Signal.pipe() - indicatorView.rex_animating <~ SignalProducer(signal: pipeSignal) + indicatorView.reactive.isAnimating <~ SignalProducer(signal: pipeSignal) - observer.sendNext(true) - XCTAssertTrue(indicatorView.isAnimating()) - observer.sendNext(false) - XCTAssertFalse(indicatorView.isAnimating()) + observer.send(value: true) + XCTAssertTrue(indicatorView.isAnimating) + observer.send(value: false) + XCTAssertFalse(indicatorView.isAnimating) } } diff --git a/Tests/UIKit/UIBarButtonItemTests.swift b/Tests/UIKit/UIBarButtonItemTests.swift index 8b65c36..91bb4f5 100644 --- a/Tests/UIKit/UIBarButtonItemTests.swift +++ b/Tests/UIKit/UIBarButtonItemTests.swift @@ -6,6 +6,7 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // +import ReactiveSwift import ReactiveCocoa import UIKit import XCTest @@ -27,20 +28,20 @@ class UIBarButtonItemTests: XCTestCase { let action = Action<(),(),NoError> { SignalProducer(value: ()) } - barButtonItem.rex_action <~ SignalProducer(value: CocoaAction(action, input: ())) + barButtonItem.reactive.pressed = CocoaAction(action, input: ()) } func testEnabledProperty() { let barButtonItem = UIBarButtonItem() - barButtonItem.enabled = true + barButtonItem.isEnabled = true let (pipeSignal, observer) = Signal.pipe() - barButtonItem.rex_enabled <~ SignalProducer(signal: pipeSignal) + barButtonItem.reactive.isEnabled <~ SignalProducer(signal: pipeSignal) - observer.sendNext(false) - XCTAssertFalse(barButtonItem.enabled) - observer.sendNext(true) - XCTAssertTrue(barButtonItem.enabled) + observer.send(value: false) + XCTAssertFalse(barButtonItem.isEnabled) + observer.send(value: true) + XCTAssertTrue(barButtonItem.isEnabled) } } diff --git a/Tests/UIKit/UIButtonTests.swift b/Tests/UIKit/UIButtonTests.swift index b8d33f7..95cd540 100644 --- a/Tests/UIKit/UIButtonTests.swift +++ b/Tests/UIKit/UIButtonTests.swift @@ -6,6 +6,7 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // +import ReactiveSwift import ReactiveCocoa import UIKit import XCTest @@ -13,86 +14,91 @@ import enum Result.NoError extension UIButton { static func button() -> UIButton { - let button = UIButton(type: UIButtonType.Custom) + let button = UIButton(type: .custom) return button; } - override public func sendAction(action: Selector, to target: AnyObject?, forEvent event: UIEvent?) { - target?.performSelector(action, withObject: nil) + override open func sendAction(_ action: Selector, to target: Any?, for event: UIEvent?) { + _ = (target as AnyObject).perform(action, with: nil) } } class UIButtonTests: XCTestCase { - +// var button: UIButton! weak var _button: UIButton? +// override func setUp() { +// button = UIButton(frame: .zero) +// _button = button +// } +// override func tearDown() { XCTAssert(_button == nil, "Retain cycle detected in UIButton properties") super.tearDown() } func testEnabledPropertyDoesntCreateRetainCycle() { - let button = UIButton(frame: CGRectZero) + let button = UIButton(frame: .zero) _button = button - button.rex_enabled <~ SignalProducer(value: false) - XCTAssert(_button?.enabled == false) + button.reactive.isEnabled <~ SignalProducer(value: false) + XCTAssert(_button?.isEnabled == false) } func testPressedPropertyDoesntCreateRetainCycle() { - let button = UIButton(frame: CGRectZero) + let button = UIButton(frame: .zero) _button = button let action = Action<(),(),NoError> { SignalProducer(value: ()) } - button.rex_pressed <~ SignalProducer(value: CocoaAction(action, input: ())) + button.reactive.pressed = CocoaAction(action, input: ()) } func testTitlePropertyDoesntCreateRetainCycle() { - let button = UIButton(frame: CGRectZero) + let button = UIButton(frame: .zero) _button = button - button.rex_title <~ SignalProducer(value: "button") - XCTAssert(_button?.titleForState(.Normal) == "button") + button.reactive.title <~ SignalProducer(value: "button") + XCTAssert(_button?.title(for: UIControlState()) == "button") } func testTitleProperty() { let firstTitle = "First title" let secondTitle = "Second title" - let button = UIButton(frame: CGRectZero) + let button = UIButton(frame: CGRect.zero) let (pipeSignal, observer) = Signal.pipe() - button.rex_title <~ SignalProducer(signal: pipeSignal) - button.setTitle("", forState: .Selected) - button.setTitle("", forState: .Highlighted) + button.reactive.title <~ SignalProducer(signal: pipeSignal) + button.setTitle("", for: .selected) + button.setTitle("", for: .highlighted) - observer.sendNext(firstTitle) - XCTAssertEqual(button.titleForState(.Normal), firstTitle) - XCTAssertEqual(button.titleForState(.Highlighted), "") - XCTAssertEqual(button.titleForState(.Selected), "") + observer.send(value: firstTitle) + XCTAssertEqual(button.title(for: .normal), firstTitle) + XCTAssertEqual(button.title(for: .highlighted), "") + XCTAssertEqual(button.title(for: .selected), "") - observer.sendNext(secondTitle) - XCTAssertEqual(button.titleForState(.Normal), secondTitle) - XCTAssertEqual(button.titleForState(.Highlighted), "") - XCTAssertEqual(button.titleForState(.Selected), "") + observer.send(value: secondTitle) + XCTAssertEqual(button.title(for: .normal), secondTitle) + XCTAssertEqual(button.title(for: .highlighted), "") + XCTAssertEqual(button.title(for: .selected), "") } func testPressedProperty() { - let button = UIButton(frame: CGRectZero) - button.enabled = true - button.userInteractionEnabled = true - - let passed = MutableProperty(false) + let button = UIButton(frame: .zero) + button.isEnabled = true + button.isUserInteractionEnabled = true + + let pressed = MutableProperty(false) let action = Action<(), Bool, NoError> { _ in SignalProducer(value: true) } - passed <~ SignalProducer(signal: action.values) - button.rex_pressed <~ SignalProducer(value: CocoaAction(action, input: ())) - - button.sendActionsForControlEvents(.TouchUpInside) + pressed <~ SignalProducer(signal: action.values) + button.reactive.pressed = CocoaAction(action) + XCTAssertFalse(pressed.value) - XCTAssertTrue(passed.value) +// button.sendActions(for: .touchUpInside) + XCTAssertTrue(pressed.value) } } diff --git a/Tests/UIKit/UICollectionReusableViewTests.swift b/Tests/UIKit/UICollectionReusableViewTests.swift index b95afac..bf8ba7e 100644 --- a/Tests/UIKit/UICollectionReusableViewTests.swift +++ b/Tests/UIKit/UICollectionReusableViewTests.swift @@ -7,7 +7,7 @@ // import XCTest -import ReactiveCocoa +import ReactiveSwift class UICollectionReusableViewTests: XCTestCase { @@ -17,19 +17,19 @@ class UICollectionReusableViewTests: XCTestCase { let cell = UICollectionViewCell() - cell.rex_hidden <~ + cell.reactive.isHidden <~ hiddenProperty .producer - .takeUntil(cell.rex_prepareForReuse) + .take(until: cell.reactive.prepareForReuse) - XCTAssertFalse(cell.hidden) + XCTAssertFalse(cell.isHidden) hiddenProperty <~ SignalProducer(value: true) - XCTAssertTrue(cell.hidden) + XCTAssertTrue(cell.isHidden) cell.prepareForReuse() hiddenProperty <~ SignalProducer(value: false) - XCTAssertTrue(cell.hidden) + XCTAssertTrue(cell.isHidden) } } diff --git a/Tests/UIKit/UIControlTests.swift b/Tests/UIKit/UIControlTests.swift index b16bfe4..537fe67 100644 --- a/Tests/UIKit/UIControlTests.swift +++ b/Tests/UIKit/UIControlTests.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import UIKit import XCTest import enum Result.NoError @@ -21,87 +21,87 @@ class UIControlTests: XCTestCase { } func testEnabledPropertyDoesntCreateRetainCycle() { - let control = UIControl(frame: CGRectZero) + let control = UIControl(frame: .zero) _control = control - control.rex_enabled <~ SignalProducer(value: false) - XCTAssert(_control?.enabled == false) + control.reactive.isEnabled <~ SignalProducer(value: false) + XCTAssert(_control?.isEnabled == false) } func testSelectedPropertyDoesntCreateRetainCycle() { - let control = UIControl(frame: CGRectZero) + let control = UIControl(frame: .zero) _control = control - control.rex_selected <~ SignalProducer(value: true) - XCTAssert(_control?.selected == true) + control.reactive.isSelected <~ SignalProducer(value: true) + XCTAssert(_control?.isSelected == true) } func testHighlightedPropertyDoesntCreateRetainCycle() { - let control = UIControl(frame: CGRectZero) + let control = UIControl(frame: .zero) _control = control - control.rex_highlighted <~ SignalProducer(value: true) - XCTAssert(_control?.highlighted == true) + control.reactive.isHighlighted <~ SignalProducer(value: true) + XCTAssert(_control?.isHighlighted == true) } func testEnabledProperty () { - let control = UIControl(frame: CGRectZero) - control.enabled = false + let control = UIControl(frame: .zero) + control.isEnabled = false let (pipeSignal, observer) = Signal.pipe() - control.rex_enabled <~ SignalProducer(signal: pipeSignal) + control.reactive.isEnabled <~ SignalProducer(signal: pipeSignal) - observer.sendNext(true) - XCTAssertTrue(control.enabled) - observer.sendNext(false) - XCTAssertFalse(control.enabled) + observer.send(value: true) + XCTAssertTrue(control.isEnabled) + observer.send(value: false) + XCTAssertFalse(control.isEnabled) } func testSelectedProperty() { - let control = UIControl(frame: CGRectZero) - control.selected = false + let control = UIControl(frame: .zero) + control.isSelected = false let (pipeSignal, observer) = Signal.pipe() - control.rex_selected <~ SignalProducer(signal: pipeSignal) + control.reactive.isSelected <~ SignalProducer(signal: pipeSignal) - observer.sendNext(true) - XCTAssertTrue(control.selected) - observer.sendNext(false) - XCTAssertFalse(control.selected) + observer.send(value: true) + XCTAssertTrue(control.isSelected) + observer.send(value: false) + XCTAssertFalse(control.isSelected) } func testHighlightedProperty() { - let control = UIControl(frame: CGRectZero) - control.highlighted = false + let control = UIControl(frame: CGRect.zero) + control.isHighlighted = false let (pipeSignal, observer) = Signal.pipe() - control.rex_highlighted <~ SignalProducer(signal: pipeSignal) + control.reactive.isHighlighted <~ SignalProducer(signal: pipeSignal) - observer.sendNext(true) - XCTAssertTrue(control.highlighted) - observer.sendNext(false) - XCTAssertFalse(control.highlighted) + observer.send(value: true) + XCTAssertTrue(control.isHighlighted) + observer.send(value: false) + XCTAssertFalse(control.isHighlighted) } func testEnabledAndSelectedProperty() { - let control = UIControl(frame: CGRectZero) - control.selected = false - control.enabled = false + let control = UIControl(frame: .zero) + control.isSelected = false + control.isEnabled = false let (pipeSignalSelected, observerSelected) = Signal.pipe() let (pipeSignalEnabled, observerEnabled) = Signal.pipe() - control.rex_selected <~ SignalProducer(signal: pipeSignalSelected) - control.rex_enabled <~ SignalProducer(signal: pipeSignalEnabled) + control.reactive.isSelected <~ SignalProducer(signal: pipeSignalSelected) + control.reactive.isEnabled <~ SignalProducer(signal: pipeSignalEnabled) - observerSelected.sendNext(true) - observerEnabled.sendNext(true) - XCTAssertTrue(control.enabled) - XCTAssertTrue(control.selected) - observerSelected.sendNext(false) - XCTAssertTrue(control.enabled) - XCTAssertFalse(control.selected) - observerEnabled.sendNext(false) - XCTAssertFalse(control.enabled) - XCTAssertFalse(control.selected) + observerSelected.send(value: true) + observerEnabled.send(value: true) + XCTAssertTrue(control.isEnabled) + XCTAssertTrue(control.isSelected) + observerSelected.send(value: false) + XCTAssertTrue(control.isEnabled) + XCTAssertFalse(control.isSelected) + observerEnabled.send(value: false) + XCTAssertFalse(control.isEnabled) + XCTAssertFalse(control.isSelected) } } diff --git a/Tests/UIKit/UIDatePickerTests.swift b/Tests/UIKit/UIDatePickerTests.swift index f29dbd6..209b770 100644 --- a/Tests/UIKit/UIDatePickerTests.swift +++ b/Tests/UIKit/UIDatePickerTests.swift @@ -6,42 +6,45 @@ // Copyright © 2016 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import UIKit import XCTest import Rex +import enum Result.NoError class UIDatePickerTests: XCTestCase { - var date: NSDate! + var date: Date! var picker: UIDatePicker! override func setUp() { - let formatter = NSDateFormatter() + let formatter = DateFormatter() formatter.dateFormat = "MM/dd/YYYY" - date = formatter.dateFromString("11/29/1988")! + date = formatter.date(from: "11/29/1988")! - picker = UIDatePicker(frame: CGRectZero) + picker = UIDatePicker(frame: .zero) } func testUpdatePickerFromProperty() { - picker.rex_date.value = date + let (signal, observer) = Signal.pipe() + picker.reactive.date <~ signal + observer.send(value: date) XCTAssertEqual(picker.date, date) } func testUpdatePropertyFromPicker() { - let expectation = self.expectationWithDescription("Expected rex_date to send an event when picker's date value is changed by a UI event") - defer { self.waitForExpectationsWithTimeout(2, handler: nil) } + let expectation = self.expectation(description: "Expected rex_date to send an event when picker's date value is changed by a UI event") + defer { self.waitForExpectations(timeout: 2, handler: nil) } - picker.rex_date.signal.observeNext { changedDate in - XCTAssertEqual(changedDate, self.date) + picker.reactive.dates.observeValues { changedDate in + XCTAssertEqual(changedDate as Date, self.date) expectation.fulfill() } picker.date = date - picker.enabled = true - picker.userInteractionEnabled = true - picker.sendActionsForControlEvents(.ValueChanged) + picker.isEnabled = true + picker.isUserInteractionEnabled = true + picker.sendActions(for: .valueChanged) } } diff --git a/Tests/UIKit/UIImageViewTests.swift b/Tests/UIKit/UIImageViewTests.swift index b632f51..e86f104 100644 --- a/Tests/UIKit/UIImageViewTests.swift +++ b/Tests/UIKit/UIImageViewTests.swift @@ -6,7 +6,7 @@ // Copyright © 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import UIKit import XCTest import enum Result.NoError @@ -21,52 +21,52 @@ class UIImageViewTests: XCTestCase { } func testImagePropertyDoesntCreateRetainCycle() { - let imageView = UIImageView(frame: CGRectZero) + let imageView = UIImageView(frame: .zero) _imageView = imageView let image = UIImage() - imageView.rex_image <~ SignalProducer(value: image) + imageView.reactive.image <~ SignalProducer(value: image) XCTAssert(_imageView?.image == image) } func testHighlightedImagePropertyDoesntCreateRetainCycle() { - let imageView = UIImageView(frame: CGRectZero) + let imageView = UIImageView(frame: .zero) _imageView = imageView let image = UIImage() - imageView.rex_highlightedImage <~ SignalProducer(value: image) + imageView.reactive.highlightedImage <~ SignalProducer(value: image) XCTAssert(_imageView?.highlightedImage == image) } func testImageProperty() { - let imageView = UIImageView(frame: CGRectZero) + let imageView = UIImageView(frame: .zero) let firstChange = UIImage() let secondChange = UIImage() let (pipeSignal, observer) = Signal.pipe() - imageView.rex_image <~ SignalProducer(signal: pipeSignal) + imageView.reactive.image <~ SignalProducer(signal: pipeSignal) - observer.sendNext(firstChange) + observer.send(value: firstChange) XCTAssertEqual(imageView.image, firstChange) - observer.sendNext(secondChange) + observer.send(value: secondChange) XCTAssertEqual(imageView.image, secondChange) } func testHighlightedImageProperty() { - let imageView = UIImageView(frame: CGRectZero) + let imageView = UIImageView(frame: .zero) let firstChange = UIImage() let secondChange = UIImage() let (pipeSignal, observer) = Signal.pipe() - imageView.rex_highlightedImage <~ SignalProducer(signal: pipeSignal) + imageView.reactive.highlightedImage <~ SignalProducer(signal: pipeSignal) - observer.sendNext(firstChange) + observer.send(value: firstChange) XCTAssertEqual(imageView.highlightedImage, firstChange) - observer.sendNext(secondChange) + observer.send(value: secondChange) XCTAssertEqual(imageView.highlightedImage, secondChange) } } diff --git a/Tests/UIKit/UILabelTests.swift b/Tests/UIKit/UILabelTests.swift index 9356b9f..e2b59fa 100644 --- a/Tests/UIKit/UILabelTests.swift +++ b/Tests/UIKit/UILabelTests.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import UIKit import XCTest import enum Result.NoError @@ -21,10 +21,10 @@ class UILabelTests: XCTestCase { } func testTextPropertyDoesntCreateRetainCycle() { - let label = UILabel(frame: CGRectZero) + let label = UILabel(frame: .zero) _label = label - label.rex_text <~ SignalProducer(value: "Test") + label.reactive.text <~ SignalProducer(value: "Test") XCTAssert(_label?.text == "Test") } @@ -32,25 +32,25 @@ class UILabelTests: XCTestCase { let firstChange = "first" let secondChange = "second" - let label = UILabel(frame: CGRectZero) + let label = UILabel(frame: .zero) label.text = "" let (pipeSignal, observer) = Signal.pipe() - label.rex_text <~ SignalProducer(signal: pipeSignal) + label.reactive.text <~ SignalProducer(signal: pipeSignal) - observer.sendNext(firstChange) + observer.send(value: firstChange) XCTAssertEqual(label.text, firstChange) - observer.sendNext(secondChange) + observer.send(value: secondChange) XCTAssertEqual(label.text, secondChange) - observer.sendNext(nil) + observer.send(value: nil) XCTAssertNil(label.text) } func testAttributedTextPropertyDoesntCreateRetainCycle() { - let label = UILabel(frame: CGRectZero) + let label = UILabel(frame: .zero) _label = label - label.rex_attributedText <~ SignalProducer(value: NSAttributedString(string: "Test")) + label.reactive.attributedText <~ SignalProducer(value: NSAttributedString(string: "Test")) XCTAssert(_label?.attributedText?.string == "Test") } @@ -58,31 +58,31 @@ class UILabelTests: XCTestCase { let firstChange = NSAttributedString(string: "first") let secondChange = NSAttributedString(string: "second") - let label = UILabel(frame: CGRectZero) + let label = UILabel(frame: .zero) label.attributedText = NSAttributedString(string: "") let (pipeSignal, observer) = Signal.pipe() - label.rex_attributedText <~ SignalProducer(signal: pipeSignal) + label.reactive.attributedText <~ SignalProducer(signal: pipeSignal) - observer.sendNext(firstChange) + observer.send(value: firstChange) XCTAssertEqual(label.attributedText, firstChange) - observer.sendNext(secondChange) + observer.send(value: secondChange) XCTAssertEqual(label.attributedText, secondChange) } func testTextColorProperty() { - let firstChange = UIColor.redColor() - let secondChange = UIColor.blackColor() + let firstChange = UIColor.red + let secondChange = UIColor.black - let label = UILabel(frame: CGRectZero) + let label = UILabel(frame: .zero) let (pipeSignal, observer) = Signal.pipe() - label.textColor = UIColor.blackColor() - label.rex_textColor <~ SignalProducer(signal: pipeSignal) + label.textColor = .black + label.reactive.textColor <~ SignalProducer(signal: pipeSignal) - observer.sendNext(firstChange) + observer.send(value: firstChange) XCTAssertEqual(label.textColor, firstChange) - observer.sendNext(secondChange) + observer.send(value: secondChange) XCTAssertEqual(label.textColor, secondChange) } } diff --git a/Tests/UIKit/UIProgressViewTests.swift b/Tests/UIKit/UIProgressViewTests.swift index 4fbe695..87c3e1c 100644 --- a/Tests/UIKit/UIProgressViewTests.swift +++ b/Tests/UIKit/UIProgressViewTests.swift @@ -6,7 +6,7 @@ // Copyright © 2016 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import UIKit import XCTest import enum Result.NoError @@ -20,10 +20,10 @@ class UIProgressViewTests: XCTestCase { } func testProgressPropertyDoesntCreateRetainCycle() { - let progressView = UIProgressView(frame: CGRectZero) + let progressView = UIProgressView(frame: .zero) _progressView = progressView - progressView.rex_progress <~ SignalProducer(value: 0.5) + progressView.reactive.progress <~ SignalProducer(value: 0.5) XCTAssert(_progressView?.progress == 0.5) } @@ -31,15 +31,15 @@ class UIProgressViewTests: XCTestCase { let firstChange: Float = 0.5 let secondChange: Float = 0.0 - let progressView = UIProgressView(frame: CGRectZero) + let progressView = UIProgressView(frame: .zero) progressView.progress = 1.0 let (pipeSignal, observer) = Signal.pipe() - progressView.rex_progress <~ SignalProducer(signal: pipeSignal) + progressView.reactive.progress <~ SignalProducer(signal: pipeSignal) - observer.sendNext(firstChange) + observer.send(value: firstChange) XCTAssertEqual(progressView.progress, firstChange) - observer.sendNext(secondChange) + observer.send(value: secondChange) XCTAssertEqual(progressView.progress, secondChange) } } diff --git a/Tests/UIKit/UISegmentedControlTests.swift b/Tests/UIKit/UISegmentedControlTests.swift index d7c7bfa..8bc962a 100644 --- a/Tests/UIKit/UISegmentedControlTests.swift +++ b/Tests/UIKit/UISegmentedControlTests.swift @@ -7,7 +7,7 @@ // import XCTest -import ReactiveCocoa +import ReactiveSwift import Result class UISegmentedControlTests: XCTestCase { @@ -18,12 +18,12 @@ class UISegmentedControlTests: XCTestCase { XCTAssertEqual(s.numberOfSegments, 3) let (pipeSignal, observer) = Signal.pipe() - s.rex_selectedSegmentIndex <~ SignalProducer(signal: pipeSignal) + s.reactive.selectedSegmentIndex <~ SignalProducer(signal: pipeSignal) XCTAssertEqual(s.selectedSegmentIndex, UISegmentedControlNoSegment) - observer.sendNext(1) + observer.send(value: 1) XCTAssertEqual(s.selectedSegmentIndex, 1) - observer.sendNext(2) + observer.send(value: 2) XCTAssertEqual(s.selectedSegmentIndex, 2) } } diff --git a/Tests/UIKit/UISwitchTests.swift b/Tests/UIKit/UISwitchTests.swift index 9391052..e33d033 100644 --- a/Tests/UIKit/UISwitchTests.swift +++ b/Tests/UIKit/UISwitchTests.swift @@ -7,25 +7,27 @@ // import XCTest -import ReactiveCocoa +import ReactiveSwift import Result class UISwitchTests: XCTestCase { func testOnProperty() { - let `switch` = UISwitch(frame: CGRectZero) - `switch`.on = false + let `switch` = UISwitch(frame: .zero) + `switch`.isOn = false let (pipeSignal, observer) = Signal.pipe() - `switch`.rex_on <~ SignalProducer(signal: pipeSignal) + `switch`.reactive.isOn <~ SignalProducer(signal: pipeSignal) - observer.sendNext(true) - XCTAssertTrue(`switch`.on) - observer.sendNext(false) - XCTAssertFalse(`switch`.on) + observer.send(value: true) + XCTAssertTrue(`switch`.isOn) + observer.send(value: false) + XCTAssertFalse(`switch`.isOn) - `switch`.on = true - `switch`.sendActionsForControlEvents(.ValueChanged) - XCTAssertTrue(`switch`.rex_on.value) + let onProperty = MutableProperty(false) + onProperty <~ `switch`.reactive.isOnValues + `switch`.isOn = true + `switch`.sendActions(for: .valueChanged) + XCTAssertTrue(onProperty.value) } } diff --git a/Tests/UIKit/UITableViewCellTests.swift b/Tests/UIKit/UITableViewCellTests.swift index d08767f..88bbaf0 100644 --- a/Tests/UIKit/UITableViewCellTests.swift +++ b/Tests/UIKit/UITableViewCellTests.swift @@ -7,7 +7,7 @@ // import XCTest -import ReactiveCocoa +import ReactiveSwift class UITableViewCellTests: XCTestCase { @@ -21,11 +21,11 @@ class UITableViewCellTests: XCTestCase { fatalError() } - label.rex_text <~ + label.reactive.text <~ titleProperty .producer .map(Optional.init) // TODO: Remove in the future, binding with optionals will be available soon in RAC 5. Reference: https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2852 - .takeUntil(cell.rex_prepareForReuse) + .take(until: cell.reactive.prepareForReuse) XCTAssertEqual(label.text, "John") diff --git a/Tests/UIKit/UITableViewHeaderFooterViewTests.swift b/Tests/UIKit/UITableViewHeaderFooterViewTests.swift index 8255e93..47648bc 100644 --- a/Tests/UIKit/UITableViewHeaderFooterViewTests.swift +++ b/Tests/UIKit/UITableViewHeaderFooterViewTests.swift @@ -7,7 +7,7 @@ // import XCTest -import ReactiveCocoa +import ReactiveSwift class UITableViewHeaderFooterViewTests: XCTestCase { @@ -17,19 +17,19 @@ class UITableViewHeaderFooterViewTests: XCTestCase { let header = UITableViewHeaderFooterView() - header.rex_hidden <~ + header.reactive.isHidden <~ hiddenProperty .producer - .takeUntil(header.rex_prepareForReuse) + .take(until: header.reactive.prepareForReuse) - XCTAssertFalse(header.hidden) + XCTAssertFalse(header.isHidden) hiddenProperty <~ SignalProducer(value: true) - XCTAssertTrue(header.hidden) + XCTAssertTrue(header.isHidden) header.prepareForReuse() hiddenProperty <~ SignalProducer(value: false) - XCTAssertTrue(header.hidden) + XCTAssertTrue(header.isHidden) } } diff --git a/Tests/UIKit/UITextFieldTests.swift b/Tests/UIKit/UITextFieldTests.swift index fee8e85..3f14afd 100644 --- a/Tests/UIKit/UITextFieldTests.swift +++ b/Tests/UIKit/UITextFieldTests.swift @@ -6,28 +6,28 @@ // Copyright © 2016 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import UIKit import XCTest class UITextFieldTests: XCTestCase { func testTextProperty() { - let expectation = self.expectationWithDescription("Expected `rex_text`'s value to equal to the textField's text") - defer { self.waitForExpectationsWithTimeout(2, handler: nil) } + let expectation = self.expectation(description: "Expected `rex_text`'s value to equal to the textField's text") + defer { self.waitForExpectations(timeout: 2, handler: nil) } - let textField = UITextField(frame: CGRectZero) + let textField = UITextField(frame: .zero) textField.text = "Test" - textField.rex_text.signal.observeNext { text in + textField.reactive.continuousTextValues.observeValues { text in XCTAssertEqual(text, textField.text) expectation.fulfill() } #if os(iOS) - textField.sendActionsForControlEvents(.EditingChanged) + textField.sendActions(for: .editingChanged) #else - NSNotificationCenter.defaultCenter().postNotificationName(UITextFieldTextDidChangeNotification, object: textField) + NotificationCenter.default.post(name: NSNotification.Name.UITextFieldTextDidChange, object: textField) #endif } } diff --git a/Tests/UIKit/UITextViewTests.swift b/Tests/UIKit/UITextViewTests.swift index 2ae4fc5..97a65a2 100644 --- a/Tests/UIKit/UITextViewTests.swift +++ b/Tests/UIKit/UITextViewTests.swift @@ -6,24 +6,24 @@ // Copyright © 2016 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import UIKit import XCTest class UITextViewTests: XCTestCase { func testTextProperty() { - let expectation = self.expectationWithDescription("Expected `rex_text`'s value to equal to the textViews's text") - defer { self.waitForExpectationsWithTimeout(2, handler: nil) } + let expectation = self.expectation(description: "Expected `rex_text`'s value to equal to the textViews's text") + defer { self.waitForExpectations(timeout: 2, handler: nil) } - let textView = UITextView(frame: CGRectZero) + let textView = UITextView(frame: .zero) textView.text = "Test" - textView.rex_text.startWithNext { text in + textView.reactive.continuousTextValues.observeValues { text in XCTAssertEqual(text, textView.text) expectation.fulfill() } - NSNotificationCenter.defaultCenter().postNotificationName(UITextViewTextDidChangeNotification, object: textView) + NotificationCenter.default.post(name: NSNotification.Name.UITextViewTextDidChange, object: textView) } } diff --git a/Tests/UIKit/UIViewControllerTests.swift b/Tests/UIKit/UIViewControllerTests.swift index 04bf211..ae2ecd9 100644 --- a/Tests/UIKit/UIViewControllerTests.swift +++ b/Tests/UIKit/UIViewControllerTests.swift @@ -6,7 +6,7 @@ // Copyright © 2016 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import UIKit import XCTest import enum Result.NoError @@ -22,13 +22,13 @@ class UIViewControllerTests: XCTestCase { func testViewDidDisappear() { - let expectation = self.expectationWithDescription("Expected rex_viewDidDisappear to be triggered") - defer { self.waitForExpectationsWithTimeout(2, handler: nil) } + let expectation = self.expectation(description: "Expected rex_viewDidDisappear to be triggered") + defer { self.waitForExpectations(timeout: 2, handler: nil) } let viewController = UIViewController() _viewController = viewController - viewController.rex_viewDidDisappear.observeNext { + viewController.rex_viewDidDisappear.observeValues { expectation.fulfill() } @@ -37,13 +37,13 @@ class UIViewControllerTests: XCTestCase { func testViewWillDisappear() { - let expectation = self.expectationWithDescription("Expected rex_viewWillDisappear to be triggered") - defer { self.waitForExpectationsWithTimeout(2, handler: nil) } + let expectation = self.expectation(description: "Expected rex_viewWillDisappear to be triggered") + defer { self.waitForExpectations(timeout: 2, handler: nil) } let viewController = UIViewController() _viewController = viewController - viewController.rex_viewWillDisappear.observeNext { + viewController.rex_viewWillDisappear.observeValues { expectation.fulfill() } @@ -52,13 +52,13 @@ class UIViewControllerTests: XCTestCase { func testViewDidAppear() { - let expectation = self.expectationWithDescription("Expected rex_viewDidAppear to be triggered") - defer { self.waitForExpectationsWithTimeout(2, handler: nil) } + let expectation = self.expectation(description: "Expected rex_viewDidAppear to be triggered") + defer { self.waitForExpectations(timeout: 2, handler: nil) } let viewController = UIViewController() _viewController = viewController - viewController.rex_viewDidAppear.observeNext { + viewController.rex_viewDidAppear.observeValues { expectation.fulfill() } @@ -67,13 +67,13 @@ class UIViewControllerTests: XCTestCase { func testViewWillAppear() { - let expectation = self.expectationWithDescription("Expected rex_viewWillAppear to be triggered") - defer { self.waitForExpectationsWithTimeout(2, handler: nil) } + let expectation = self.expectation(description: "Expected rex_viewWillAppear to be triggered") + defer { self.waitForExpectations(timeout: 2, handler: nil) } let viewController = UIViewController() _viewController = viewController - viewController.rex_viewWillAppear.observeNext { + viewController.rex_viewWillAppear.observeValues { expectation.fulfill() } @@ -82,13 +82,13 @@ class UIViewControllerTests: XCTestCase { func testDismissViewController_via_property() { - let expectation = self.expectationWithDescription("Expected rex_dismissModally to be triggered") - defer { self.waitForExpectationsWithTimeout(2, handler: nil) } + let expectation = self.expectation(description: "Expected rex_dismissModally to be triggered") + defer { self.waitForExpectations(timeout: 2, handler: nil) } let viewController = UIViewController() _viewController = viewController - viewController.rex_dismissAnimated.signal.observeNext { _ in + viewController.rex_dismissAnimated.signal.observeValues { _ in expectation.fulfill() } @@ -97,16 +97,16 @@ class UIViewControllerTests: XCTestCase { func testDismissViewController_via_cocoaDismiss() { - let expectation = self.expectationWithDescription("Expected rex_dismissModally to be triggered") - defer { self.waitForExpectationsWithTimeout(2, handler: nil) } + let expectation = self.expectation(description: "Expected rex_dismissModally to be triggered") + defer { self.waitForExpectations(timeout: 2, handler: nil) } let viewController = UIViewController() _viewController = viewController - viewController.rex_dismissAnimated.signal.observeNext { _ in + viewController.rex_dismissAnimated.signal.observeValues { _ in expectation.fulfill() } - viewController.dismissViewControllerAnimated(true, completion: nil) + viewController.dismiss(animated: true, completion: nil) } } diff --git a/Tests/UIKit/UIViewTests.swift b/Tests/UIKit/UIViewTests.swift index acd51c3..caf78e6 100644 --- a/Tests/UIKit/UIViewTests.swift +++ b/Tests/UIKit/UIViewTests.swift @@ -6,7 +6,7 @@ // Copyright © 2015 Neil Pankey. All rights reserved. // -import ReactiveCocoa +import ReactiveSwift import UIKit import XCTest import enum Result.NoError @@ -21,60 +21,60 @@ class UIViewTests: XCTestCase { } func testAlphaPropertyDoesntCreateRetainCycle() { - let view = UIView(frame: CGRectZero) + let view = UIView(frame: .zero) _view = view - view.rex_alpha <~ SignalProducer(value: 0.5) + view.reactive.alpha <~ SignalProducer(value: 0.5) XCTAssertEqualWithAccuracy(_view!.alpha, 0.5, accuracy: 0.01) } func testHiddenPropertyDoesntCreateRetainCycle() { - let view = UIView(frame: CGRectZero) + let view = UIView(frame: .zero) _view = view - view.rex_hidden <~ SignalProducer(value: true) - XCTAssert(_view?.hidden == true) + view.reactive.isHidden <~ SignalProducer(value: true) + XCTAssert(_view?.isHidden == true) } func testHiddenProperty() { - let view = UIView(frame: CGRectZero) - view.hidden = true + let view = UIView(frame: .zero) + view.isHidden = true let (pipeSignal, observer) = Signal.pipe() - view.rex_hidden <~ SignalProducer(signal: pipeSignal) + view.reactive.isHidden <~ SignalProducer(signal: pipeSignal) - observer.sendNext(true) - XCTAssertTrue(view.hidden) - observer.sendNext(false) - XCTAssertFalse(view.hidden) + observer.send(value: true) + XCTAssertTrue(view.isHidden) + observer.send(value: false) + XCTAssertFalse(view.isHidden) } func testAlphaProperty() { - let view = UIView(frame: CGRectZero) + let view = UIView(frame: .zero) view.alpha = 0.0 let firstChange = CGFloat(0.5) let secondChange = CGFloat(0.7) let (pipeSignal, observer) = Signal.pipe() - view.rex_alpha <~ SignalProducer(signal: pipeSignal) + view.reactive.alpha <~ SignalProducer(signal: pipeSignal) - observer.sendNext(firstChange) + observer.send(value: firstChange) XCTAssertEqualWithAccuracy(view.alpha, firstChange, accuracy: 0.01) - observer.sendNext(secondChange) + observer.send(value: secondChange) XCTAssertEqualWithAccuracy(view.alpha, secondChange, accuracy: 0.01) } func testUserInteractionEnabledProperty() { - let view = UIView(frame: CGRectZero) - view.userInteractionEnabled = true + let view = UIView(frame: .zero) + view.isUserInteractionEnabled = true let (pipeSignal, observer) = Signal.pipe() - view.rex_userInteractionEnabled <~ SignalProducer(signal: pipeSignal) + view.reactive.isUserInteractionEnabled <~ SignalProducer(signal: pipeSignal) - observer.sendNext(true) - XCTAssertTrue(view.userInteractionEnabled) - observer.sendNext(false) - XCTAssertFalse(view.userInteractionEnabled) + observer.send(value: true) + XCTAssertTrue(view.isUserInteractionEnabled) + observer.send(value: false) + XCTAssertFalse(view.isUserInteractionEnabled) } } From 1cd22b5a7905268bba4b0c88c00a28ab8e9f74ac Mon Sep 17 00:00:00 2001 From: Markus Chmelar Date: Mon, 31 Oct 2016 10:30:13 +0100 Subject: [PATCH 2/4] Fix failing testcases --- Rex.xcodeproj/project.pbxproj | 2 + Source/Foundation/Association.swift | 8 ++-- Tests/Foundation/NSObjectTests.swift | 13 +++--- ...ol+EnableSendActionsForControlEvents.swift | 41 ++++++++++--------- Tests/UIKit/UIButtonTests.swift | 21 +--------- Tests/UIKit/UITextFieldTests.swift | 15 +++---- 6 files changed, 44 insertions(+), 56 deletions(-) diff --git a/Rex.xcodeproj/project.pbxproj b/Rex.xcodeproj/project.pbxproj index c92f7ec..01c4679 100644 --- a/Rex.xcodeproj/project.pbxproj +++ b/Rex.xcodeproj/project.pbxproj @@ -21,6 +21,7 @@ 21A374881DC69D0800521C86 /* Deprecations+Removals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A374861DC68E8D00521C86 /* Deprecations+Removals.swift */; }; 21A374891DC69D0900521C86 /* Deprecations+Removals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A374861DC68E8D00521C86 /* Deprecations+Removals.swift */; }; 21A3748A1DC69D0900521C86 /* Deprecations+Removals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A374861DC68E8D00521C86 /* Deprecations+Removals.swift */; }; + 21F31BCF1DC74687008C9E5B /* UIControl+EnableSendActionsForControlEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D0DABA91CCC381F00B6CD2B /* UIControl+EnableSendActionsForControlEvents.swift */; }; 45CED46F1D27C1E300788BDC /* UIActivityIndicatorViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CED46D1D27C1D400788BDC /* UIActivityIndicatorViewTests.swift */; }; 45CED4701D27C1E400788BDC /* UIActivityIndicatorViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CED46D1D27C1D400788BDC /* UIActivityIndicatorViewTests.swift */; }; 4A8EDADB1D54D12400A1734C /* UIControl+EnableSendActionsForControlEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D0DABA91CCC381F00B6CD2B /* UIControl+EnableSendActionsForControlEvents.swift */; }; @@ -903,6 +904,7 @@ D8715DE21C211643005F4191 /* UIControlTests.swift in Sources */, CC02C18C1CCA704F0025CC04 /* ActionTests.swift in Sources */, D8715DDF1C21163B005F4191 /* NSObjectTests.swift in Sources */, + 21F31BCF1DC74687008C9E5B /* UIControl+EnableSendActionsForControlEvents.swift in Sources */, 7DC3257E1CC6FD1C00746D88 /* UITableViewCellTests.swift in Sources */, D8715DDC1C211637005F4191 /* PropertyTests.swift in Sources */, D8715DDD1C211637005F4191 /* SignalTests.swift in Sources */, diff --git a/Source/Foundation/Association.swift b/Source/Foundation/Association.swift index d92a11b..6d7d228 100644 --- a/Source/Foundation/Association.swift +++ b/Source/Foundation/Association.swift @@ -33,8 +33,7 @@ public func associatedProperty(_ host: AnyObject, keyPath: StaticString) -> Muta /// /// This can be used as an alternative to `DynamicProperty` for creating strongly typed /// bindings on Cocoa objects. - -public func associatedProperty(_ host: AnyObject, keyPath: StaticString, placeholder: @escaping () -> T) -> MutableProperty { +public func associatedProperty(_ host: AnyObject, keyPath: StaticString, placeholder: () -> T) -> MutableProperty { let setter: (AnyObject, T) -> () = { host, newValue in host.setValue(newValue, forKeyPath: keyPath.description) } @@ -50,8 +49,7 @@ public func associatedProperty(_ host: AnyObject, keyPath: StaticS /// /// This can be used as an alternative to `DynamicProperty` for creating strongly typed /// bindings on Cocoa objects. - -public func associatedProperty(_ host: Host, key: UnsafeRawPointer, initial: @escaping (Host) -> T, setter: @escaping (Host, T) -> (), setUp: (MutableProperty) -> () = { _ in }) -> MutableProperty { +public func associatedProperty(_ host: Host, key: UnsafeRawPointer, initial: (Host) -> T, setter: @escaping (Host, T) -> (), setUp: (MutableProperty) -> () = { _ in }) -> MutableProperty { return associatedObject(host, key: key) { host in let property = MutableProperty(initial(host)) @@ -70,7 +68,7 @@ public func associatedProperty(_ host: Host, key: UnsafeRawP /// On first use attaches the object returned from `initial` to the `host` object using /// `key` via `objc_setAssociatedObject`. On subsequent usage, returns said object via /// `objc_getAssociatedObject`. -public func associatedObject(_ host: Host, key: UnsafeRawPointer, initial: (Host) -> T) -> T { +public func associatedObject(_ host: Host, key: UnsafeRawPointer, initial: (Host) -> T) -> T { var value = objc_getAssociatedObject(host, key) as? T if value == nil { value = initial(host) diff --git a/Tests/Foundation/NSObjectTests.swift b/Tests/Foundation/NSObjectTests.swift index 38a9701..c718cbc 100644 --- a/Tests/Foundation/NSObjectTests.swift +++ b/Tests/Foundation/NSObjectTests.swift @@ -9,6 +9,7 @@ import Rex import ReactiveSwift import XCTest +import enum Result.NoError final class NSObjectTests: XCTestCase { @@ -55,12 +56,12 @@ final class NSObjectDeallocTests: XCTestCase { XCTAssert(_object?.string == "Test") } -// func testClassPropertyDoesntCreateRetainCycle() { -// let object = Object() -// _object = object -// associatedProperty(object, keyPath: "string", placeholder: { _ in "" }) <~ SignalProducer(value: "Test") -// XCTAssert(_object?.string == "Test") -// } + func testClassPropertyDoesntCreateRetainCycle() { + let object = Object() + _object = object + associatedProperty(object, keyPath: "string", placeholder: { "Test"} ) <~ SignalProducer(value: "Test") + XCTAssert(_object?.string == "Test") + } } class Object: NSObject { diff --git a/Tests/Helpers/UIControl+EnableSendActionsForControlEvents.swift b/Tests/Helpers/UIControl+EnableSendActionsForControlEvents.swift index eb9b9f1..28e41cb 100644 --- a/Tests/Helpers/UIControl+EnableSendActionsForControlEvents.swift +++ b/Tests/Helpers/UIControl+EnableSendActionsForControlEvents.swift @@ -8,44 +8,47 @@ import UIKit -/// Unfortunately, there's an apparent limitation in using `sendActionsForControlEvents` -/// on unit-tests for any control besides `UIButton` which is very unfortunate since we -/// want test our bindings for `UIDatePicker`, `UISwitch`, `UITextField` and others -/// in the future. To be able to test them, we're now using swizzling to manually invoke -/// the pair target+action. -fileprivate let swizzling: (UIControl.Type) -> () = { control in - let originalSelector = #selector(control.sendAction(_:to:for:)) - let swizzledSelector = #selector(control.rex_sendAction(_:to:forEvent:)) +private let rac_swizzleToken: Void = { + let originalSelector = #selector(UIControl.sendAction(_:to:for:)) + let swizzledSelector = #selector(UIControl.rac_sendAction(_:to:forEvent:)) - let originalMethod = class_getInstanceMethod(control, originalSelector) - let swizzledMethod = class_getInstanceMethod(control, swizzledSelector) + let originalMethod = class_getInstanceMethod(UIControl.self, originalSelector) + let swizzledMethod = class_getInstanceMethod(UIControl.self, swizzledSelector) - let didAddMethod = class_addMethod(control, + let didAddMethod = class_addMethod(UIControl.self, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod)) if didAddMethod { - class_replaceMethod(control, + class_replaceMethod(UIControl.self, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)) } else { method_exchangeImplementations(originalMethod, swizzledMethod) } -} + + return () +}() +/// Unfortunately, there's an apparent limitation in using `sendActionsForControlEvents` +/// on unit-tests for any control besides `UIButton` which is very unfortunate since we +/// want test our bindings for `UIDatePicker`, `UISwitch`, `UITextField` and others +/// in the future. To be able to test them, we're now using swizzling to manually invoke +/// the pair target+action. extension UIControl { - - open override class func initialize() { - // make sure this isn't a subclass - guard self === UIControl.self else { return } - swizzling(self) + override open class func initialize() { + guard self === UIControl.self else { + return + } + + _ = rac_swizzleToken } // MARK: - Method Swizzling - func rex_sendAction(_ action: Selector, to target: AnyObject?, forEvent event: UIEvent?) { + func rac_sendAction(_ action: Selector, to target: AnyObject?, forEvent event: UIEvent?) { _ = target?.perform(action, with: self) } } diff --git a/Tests/UIKit/UIButtonTests.swift b/Tests/UIKit/UIButtonTests.swift index 95cd540..aad426c 100644 --- a/Tests/UIKit/UIButtonTests.swift +++ b/Tests/UIKit/UIButtonTests.swift @@ -12,26 +12,9 @@ import UIKit import XCTest import enum Result.NoError -extension UIButton { - static func button() -> UIButton { - let button = UIButton(type: .custom) - return button; - } - - override open func sendAction(_ action: Selector, to target: Any?, for event: UIEvent?) { - _ = (target as AnyObject).perform(action, with: nil) - } -} - class UIButtonTests: XCTestCase { -// var button: UIButton! weak var _button: UIButton? -// override func setUp() { -// button = UIButton(frame: .zero) -// _button = button -// } -// override func tearDown() { XCTAssert(_button == nil, "Retain cycle detected in UIButton properties") super.tearDown() @@ -66,7 +49,7 @@ class UIButtonTests: XCTestCase { func testTitleProperty() { let firstTitle = "First title" let secondTitle = "Second title" - let button = UIButton(frame: CGRect.zero) + let button = UIButton(frame: .zero) let (pipeSignal, observer) = Signal.pipe() button.reactive.title <~ SignalProducer(signal: pipeSignal) button.setTitle("", for: .selected) @@ -98,7 +81,7 @@ class UIButtonTests: XCTestCase { button.reactive.pressed = CocoaAction(action) XCTAssertFalse(pressed.value) -// button.sendActions(for: .touchUpInside) + button.sendActions(for: .touchUpInside) XCTAssertTrue(pressed.value) } } diff --git a/Tests/UIKit/UITextFieldTests.swift b/Tests/UIKit/UITextFieldTests.swift index 3f14afd..08f51c4 100644 --- a/Tests/UIKit/UITextFieldTests.swift +++ b/Tests/UIKit/UITextFieldTests.swift @@ -10,12 +10,16 @@ import ReactiveSwift import UIKit import XCTest -class UITextFieldTests: XCTestCase { +import ReactiveSwift +import UIKit +import XCTest +class UITextFieldTests: XCTestCase { + func testTextProperty() { let expectation = self.expectation(description: "Expected `rex_text`'s value to equal to the textField's text") defer { self.waitForExpectations(timeout: 2, handler: nil) } - + let textField = UITextField(frame: .zero) textField.text = "Test" @@ -23,11 +27,8 @@ class UITextFieldTests: XCTestCase { XCTAssertEqual(text, textField.text) expectation.fulfill() } - -#if os(iOS) + textField.sendActions(for: .editingChanged) -#else - NotificationCenter.default.post(name: NSNotification.Name.UITextFieldTextDidChange, object: textField) -#endif } } + From ed52597679bcb0f36c58949cdf6eed8ca5ffa54d Mon Sep 17 00:00:00 2001 From: Markus Chmelar Date: Mon, 31 Oct 2016 10:44:10 +0100 Subject: [PATCH 3/4] Update README about removal of UIKit/AppKit Extensions --- README.md | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a7670db..8e6be71 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # Rex [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) Extensions for [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa) that may not fit in the core framework. -New development targets RAC 4/Swift 2/Xcode 7. For RAC 3 support [see the 0.5 -release](https://github.com/RACCommunity/Rex/releases/tag/v0.5.0). +New development targets RAC 5/Swfit 3/Xcode 8. +* For RAC 4/Swift 2/Xcode 7 support [see the 0.12 release](https://github.com/RACCommunity/Rex/releases/tag/0.12.0) +* For RAC 3 support [see the 0.5 release](https://github.com/RACCommunity/Rex/releases/tag/v0.5.0). ## Signal All `Signal` operators are available for `SignaProducer`s too via explicit `lift`ing. @@ -47,20 +48,13 @@ Partitions values from `producer` into new producer groups based on the key retu func groupBy(grouping: T -> K) -> SignalProducer<(K, SignalProducer), E> ``` -## UIKit Extensions +## UIKit / AppKit Extensions -##### `UIButton.rex_pressed` - -Flexible way to bind `CocoaAction` to the press of button. In addition the button will be disabled during the `Action` executing. Such behavior is convenient for tasks that require some time, like a download process in the example below. +As of RAC 5, UIKit and AppKit Extensions have been moved from REX [to RAC](https://github.com/ReactiveCocoa/ReactiveCocoa/releases/tag/5.0.0-alpha.1). +They are now accessible via `reactive` with pure RAC, e.g: ```swift -let downloadAction = Action { _ in - let url = NSURL(string: "https://github.com/RACCommunity/Rex/archive/master.zip") - let request = NSURLRequest(URL: url!) - return NSURLSession.sharedSession().rac_dataWithRequest(request).map { $0.0 } -} - -downloadButton.rex_pressed.value = downloadAction.unsafeCocoaAction +imageView.reactive.image <~ SignalProducer(value: image) ``` ## License From 26056fc952408522bf1d7a36acd73bf03f018fb1 Mon Sep 17 00:00:00 2001 From: Markus Chmelar Date: Mon, 31 Oct 2016 12:26:39 +0100 Subject: [PATCH 4/4] Drop Xcode 7.3 from Travis CI --- .travis.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index ca2289c..5ca52c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,6 @@ language: objective-c matrix: include: - - osx_image: xcode7.3 - env: PLATFORM=Mac - - osx_image: xcode7.3 - env: PLATFORM=iOS - - osx_image: xcode7.3 - env: PLATFORM=tvOS - - osx_image: xcode7.3 - env: PLATFORM=watchOS - - osx_image: xcode7.3 - env: PLATFORM=CocoaPods - osx_image: xcode8 env: PLATFORM=Mac TEST_ACTION="build-for-testing test-without-building" - osx_image: xcode8