From f2861890e55c9bc9e1ad7eecd23902e62647f17f Mon Sep 17 00:00:00 2001 From: Torsten Curdt Date: Sun, 24 Jul 2016 15:04:30 +0200 Subject: [PATCH 1/6] added support for UIPageControl --- Source/UIKit/UIPageControl.swift | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Source/UIKit/UIPageControl.swift diff --git a/Source/UIKit/UIPageControl.swift b/Source/UIKit/UIPageControl.swift new file mode 100644 index 0000000..676fe63 --- /dev/null +++ b/Source/UIKit/UIPageControl.swift @@ -0,0 +1,26 @@ +// +// UIPageControl.swift +// Rex +// +// Created by Torsten Curdt on 7/24/16. +// Copyright (c) 2015 Torsten Curdt. All rights reserved. +// + +import ReactiveCocoa +import UIKit + +extension UIPageControl { + + /// Wraps a label's `numberOfPages` value in a bindable property. + public var rex_numberOfPages: MutableProperty { + return associatedProperty(self, key: &numberOfPagesKey, initial: { $0.numberOfPages }, setter: { $0.numberOfPages = $1 }) + } + + /// Wraps a label's `currentPage` value in a bindable property. + public var rex_currentPage: MutableProperty { + return associatedProperty(self, key: ¤tPageKey, initial: { $0.currentPage }, setter: { $0.currentPage = $1 }) + } +} + +private var numberOfPagesKey: UInt8 = 0 +private var currentPageKey: UInt8 = 0 From da9a0710cd9862da4516501f6cef3127f30a5c06 Mon Sep 17 00:00:00 2001 From: Torsten Curdt Date: Sun, 24 Jul 2016 17:17:50 +0200 Subject: [PATCH 2/6] fixed copy&paste error in comment --- Source/UIKit/UIPageControl.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/UIKit/UIPageControl.swift b/Source/UIKit/UIPageControl.swift index 676fe63..84e9413 100644 --- a/Source/UIKit/UIPageControl.swift +++ b/Source/UIKit/UIPageControl.swift @@ -11,12 +11,12 @@ import UIKit extension UIPageControl { - /// Wraps a label's `numberOfPages` value in a bindable property. + /// Wraps a page control's `numberOfPages` value in a bindable property. public var rex_numberOfPages: MutableProperty { return associatedProperty(self, key: &numberOfPagesKey, initial: { $0.numberOfPages }, setter: { $0.numberOfPages = $1 }) } - /// Wraps a label's `currentPage` value in a bindable property. + /// Wraps a page control's `currentPage` value in a bindable property. public var rex_currentPage: MutableProperty { return associatedProperty(self, key: ¤tPageKey, initial: { $0.currentPage }, setter: { $0.currentPage = $1 }) } From 9d8f662b0423a41f41be4ca6b7a48315d4b8f53e Mon Sep 17 00:00:00 2001 From: Torsten Curdt Date: Mon, 25 Jul 2016 00:27:30 +0200 Subject: [PATCH 3/6] added test --- Tests/UIKit/UIPageControlTest.swift | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Tests/UIKit/UIPageControlTest.swift diff --git a/Tests/UIKit/UIPageControlTest.swift b/Tests/UIKit/UIPageControlTest.swift new file mode 100644 index 0000000..06a5adb --- /dev/null +++ b/Tests/UIKit/UIPageControlTest.swift @@ -0,0 +1,47 @@ +// +// UIPageControl.swift +// Rex +// +// Created by Torsten Curdt on 7/24/16. +// Copyright (c) 2015 Torsten Curdt. All rights reserved. +// + +import XCTest +import ReactiveCocoa +import Result + +class UIPageControlTests: XCTestCase { + + weak var _pageControl: UIPageControl? + + override func tearDown() { + XCTAssert(_pageControl == nil, "Retain cycle detected in UIPageControl properties") + super.tearDown() + } + + func testNumberOfPages() { + let pageControl = UIPageControl(frame: CGRectZero) + _pageControl = pageControl + + let (pipeSignal, observer) = Signal.pipe() + pageControl.rex_numberOfPages <~ SignalProducer(signal: pipeSignal) + + observer.sendNext(1) + XCTAssertTrue(pageControl.numberOfPages == 1) + observer.sendNext(2) + XCTAssertTrue(pageControl.numberOfPages == 2) + } + + func testNumberOfPages() { + let pageControl = UIPageControl(frame: CGRectZero) + _pageControl = pageControl + + let (pipeSignal, observer) = Signal.pipe() + pageControl.rex_currentPage <~ SignalProducer(signal: pipeSignal) + + observer.sendNext(1) + XCTAssertTrue(pageControl.currentPage == 1) + observer.sendNext(2) + XCTAssertTrue(pageControl.currentPage == 2) + } +} From 3f948b7848a3a4db86224a81fad32f6a2d4a7da7 Mon Sep 17 00:00:00 2001 From: Torsten Curdt Date: Mon, 25 Jul 2016 01:23:54 +0200 Subject: [PATCH 4/6] renamed test, added to project --- Rex.xcodeproj/project.pbxproj | 66 +++++++++++-------- ...rolTest.swift => UIPageControlTests.swift} | 2 +- 2 files changed, 40 insertions(+), 28 deletions(-) rename Tests/UIKit/{UIPageControlTest.swift => UIPageControlTests.swift} (97%) diff --git a/Rex.xcodeproj/project.pbxproj b/Rex.xcodeproj/project.pbxproj index a043fc4..5825ce6 100644 --- a/Rex.xcodeproj/project.pbxproj +++ b/Rex.xcodeproj/project.pbxproj @@ -39,6 +39,10 @@ 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 */; }; + 9D182AB71D4584AA009985E5 /* UIPageControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D182AB61D4584AA009985E5 /* UIPageControl.swift */; }; + 9D182AB81D4584AA009985E5 /* UIPageControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D182AB61D4584AA009985E5 /* UIPageControl.swift */; }; + 9D182ABA1D4584CC009985E5 /* UIPageControlTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D182AB91D4584CC009985E5 /* UIPageControlTests.swift */; }; + 9D182ABB1D4584CC009985E5 /* UIPageControlTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D182AB91D4584CC009985E5 /* UIPageControlTests.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 */; }; @@ -56,8 +60,8 @@ CC02C18B1CCA704F0025CC04 /* ActionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC02C1881CCA704C0025CC04 /* ActionTests.swift */; }; CC02C18C1CCA704F0025CC04 /* ActionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC02C1881CCA704C0025CC04 /* ActionTests.swift */; }; D8003E941AFEC3D400D7D3C5 /* Rex.h in Headers */ = {isa = PBXBuildFile; fileRef = D8003E931AFEC3D400D7D3C5 /* Rex.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D8003EB41AFEC6B000D7D3C5 /* ReactiveCocoa.framework in (null) */ = {isa = PBXBuildFile; fileRef = D8003EAD1AFEC68A00D7D3C5 /* ReactiveCocoa.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - D8003EB51AFEC6B000D7D3C5 /* Result.framework in (null) */ = {isa = PBXBuildFile; fileRef = D8003EAE1AFEC68A00D7D3C5 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + D8003EB41AFEC6B000D7D3C5 /* ReactiveCocoa.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D8003EAD1AFEC68A00D7D3C5 /* ReactiveCocoa.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + D8003EB51AFEC6B000D7D3C5 /* Result.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D8003EAE1AFEC68A00D7D3C5 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; D8003EB91AFEC7A900D7D3C5 /* SignalProducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8003EB81AFEC7A900D7D3C5 /* SignalProducer.swift */; }; D8003EBD1AFED01000D7D3C5 /* Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8003EBC1AFED01000D7D3C5 /* Signal.swift */; }; D8003EC21AFED30F00D7D3C5 /* SignalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8003EBE1AFED2F800D7D3C5 /* SignalTests.swift */; }; @@ -71,8 +75,8 @@ D83457331AFEE4930070616A /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8003EAE1AFEC68A00D7D3C5 /* Result.framework */; }; D83457351AFEE4B20070616A /* ReactiveCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8003EC91AFEE3ED00D7D3C5 /* ReactiveCocoa.framework */; }; D83457361AFEE4B20070616A /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8003ECA1AFEE3ED00D7D3C5 /* Result.framework */; }; - D83457391AFEE4BE0070616A /* ReactiveCocoa.framework in (null) */ = {isa = PBXBuildFile; fileRef = D8003EC91AFEE3ED00D7D3C5 /* ReactiveCocoa.framework */; }; - D834573A1AFEE4BE0070616A /* Result.framework in (null) */ = {isa = PBXBuildFile; fileRef = D8003ECA1AFEE3ED00D7D3C5 /* Result.framework */; }; + D83457391AFEE4BE0070616A /* ReactiveCocoa.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D8003EC91AFEE3ED00D7D3C5 /* ReactiveCocoa.framework */; }; + D834573A1AFEE4BE0070616A /* Result.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D8003ECA1AFEE3ED00D7D3C5 /* Result.framework */; }; D834573C1AFEE57E0070616A /* ReactiveCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8003EC91AFEE3ED00D7D3C5 /* ReactiveCocoa.framework */; }; D834573D1AFEE57E0070616A /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8003ECA1AFEE3ED00D7D3C5 /* Result.framework */; }; D83457411AFEE6050070616A /* SignalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8003EBE1AFED2F800D7D3C5 /* SignalTests.swift */; }; @@ -125,8 +129,8 @@ D8715DE51C211643005F4191 /* UIViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8289A2E61BD7F7730097FB60 /* UIViewTests.swift */; }; D8715DE61C21170C005F4191 /* ReactiveCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8715DC21C211310005F4191 /* ReactiveCocoa.framework */; }; D8715DE71C21170C005F4191 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8715DC31C211310005F4191 /* Result.framework */; }; - D8715DE91C211739005F4191 /* ReactiveCocoa.framework in (null) */ = {isa = PBXBuildFile; fileRef = D8715DC21C211310005F4191 /* ReactiveCocoa.framework */; }; - D8715DEA1C211739005F4191 /* Result.framework in (null) */ = {isa = PBXBuildFile; fileRef = D8715DC31C211310005F4191 /* Result.framework */; }; + D8715DE91C211739005F4191 /* ReactiveCocoa.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D8715DC21C211310005F4191 /* ReactiveCocoa.framework */; }; + D8715DEA1C211739005F4191 /* Result.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D8715DC31C211310005F4191 /* Result.framework */; }; D8A454061BD26A1A00C9E790 /* Property.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A454051BD26A1A00C9E790 /* Property.swift */; }; D8A454071BD26A1A00C9E790 /* Property.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A454051BD26A1A00C9E790 /* Property.swift */; }; D8A454091BD2772700C9E790 /* PropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A454081BD2772700C9E790 /* PropertyTests.swift */; }; @@ -140,12 +144,12 @@ 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 */; }; - D8F0974A1B17F5E1002E15BA /* NSObjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F097471B17F5DD002E15BA /* NSObjectTests.swift */; }; - D8F0974B1B17F5E2002E15BA /* NSObjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F097471B17F5DD002E15BA /* NSObjectTests.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -173,49 +177,49 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - D8003EB21AFEC6A800D7D3C5 /* (null) */ = { + D8003EB21AFEC6A800D7D3C5 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 16; files = ( - D8003EB41AFEC6B000D7D3C5 /* ReactiveCocoa.framework in (null) */, - D8003EB51AFEC6B000D7D3C5 /* Result.framework in (null) */, + D8003EB41AFEC6B000D7D3C5 /* ReactiveCocoa.framework in CopyFiles */, + D8003EB51AFEC6B000D7D3C5 /* Result.framework in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; - D83457371AFEE4B80070616A /* (null) */ = { + D83457371AFEE4B80070616A /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 16; files = ( - D83457391AFEE4BE0070616A /* ReactiveCocoa.framework in (null) */, - D834573A1AFEE4BE0070616A /* Result.framework in (null) */, + D83457391AFEE4BE0070616A /* ReactiveCocoa.framework in CopyFiles */, + D834573A1AFEE4BE0070616A /* Result.framework in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; - D8715DE81C21172A005F4191 /* (null) */ = { + D8715DE81C21172A005F4191 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 16; files = ( - D8715DE91C211739005F4191 /* ReactiveCocoa.framework in (null) */, - D8715DEA1C211739005F4191 /* Result.framework in (null) */, + D8715DE91C211739005F4191 /* ReactiveCocoa.framework in CopyFiles */, + D8715DEA1C211739005F4191 /* Result.framework in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* 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 = ""; }; 45CED46D1D27C1D400788BDC /* UIActivityIndicatorViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIActivityIndicatorViewTests.swift; sourceTree = ""; }; - 4238D5951B4D5950008534C0 /* NSTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; name = NSTextField.swift; path = AppKit/NSTextField.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 = ""; }; 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; }; @@ -233,6 +237,8 @@ 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; }; + 9D182AB61D4584AA009985E5 /* UIPageControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIPageControl.swift; sourceTree = ""; }; + 9D182AB91D4584CC009985E5 /* UIPageControlTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIPageControlTests.swift; sourceTree = ""; }; 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; }; @@ -274,11 +280,11 @@ D8A454081BD2772700C9E790 /* PropertyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = PropertyTests.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 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; }; - 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 = ""; }; 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 */ /* Begin PBXFrameworksBuildPhase section */ @@ -468,6 +474,7 @@ 9DA915A31CA6301C003723B9 /* UIDatePicker.swift */, 8289A2E21BD7EF740097FB60 /* UIImageView.swift */, D86FFBD71B34B242001A89B3 /* UILabel.swift */, + 9D182AB61D4584AA009985E5 /* UIPageControl.swift */, E6933BE61CD9C0B2006F7CE7 /* UIProgressView.swift */, 7D2AA99A1CB6EFEB008AB5C9 /* UISwitch.swift */, 5B1C882D1D0715CE000B888F /* UISegmentedControl.swift */, @@ -513,6 +520,7 @@ 9DA915A51CA63046003723B9 /* UIDatePickerTests.swift */, 8289A2E01BD7EF1F0097FB60 /* UIImageViewTests.swift */, D8F073141B861B3A0047D546 /* UILabelTests.swift */, + 9D182AB91D4584CC009985E5 /* UIPageControlTests.swift */, E6933BE81CD9C1F1006F7CE7 /* UIProgressViewTests.swift */, 7D2AA99C1CB6F275008AB5C9 /* UISwitchTests.swift */, 5B1C882F1D071639000B888F /* UISegmentedControlTests.swift */, @@ -608,7 +616,7 @@ D8003E951AFEC3D400D7D3C5 /* Sources */, D8003E961AFEC3D400D7D3C5 /* Frameworks */, D8003E971AFEC3D400D7D3C5 /* Resources */, - D8003EB21AFEC6A800D7D3C5 /* (null) */, + D8003EB21AFEC6A800D7D3C5 /* CopyFiles */, ); buildRules = ( ); @@ -645,7 +653,7 @@ D834571A1AFEE44E0070616A /* Sources */, D834571B1AFEE44E0070616A /* Frameworks */, D834571C1AFEE44E0070616A /* Resources */, - D83457371AFEE4B80070616A /* (null) */, + D83457371AFEE4B80070616A /* CopyFiles */, ); buildRules = ( ); @@ -700,7 +708,7 @@ D8715DCD1C21160A005F4191 /* Sources */, D8715DCE1C21160A005F4191 /* Frameworks */, D8715DCF1C21160A005F4191 /* Resources */, - D8715DE81C21172A005F4191 /* (null) */, + D8715DE81C21172A005F4191 /* CopyFiles */, ); buildRules = ( ); @@ -745,7 +753,7 @@ }; }; }; - buildConfigurationList = D8003E881AFEC3D400D7D3C5 /* Build configuration list for PBXProject "Rex-Mac" */; + buildConfigurationList = D8003E881AFEC3D400D7D3C5 /* Build configuration list for PBXProject "Rex" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -878,6 +886,7 @@ D834572E1AFEE45B0070616A /* SignalProducer.swift in Sources */, C7DCE2B41CB3C89A001217D8 /* UITextView.swift in Sources */, 8289A2E51BD7F6DD0097FB60 /* UIView.swift in Sources */, + 9D182AB71D4584AA009985E5 /* UIPageControl.swift in Sources */, D86FFBD61B34B116001A89B3 /* UIControl.swift in Sources */, D8F0973F1B17F31E002E15BA /* NSData.swift in Sources */, D86FFBDD1B34B691001A89B3 /* UIButton.swift in Sources */, @@ -909,6 +918,7 @@ D83457301AFEE45E0070616A /* SignalProducerTests.swift in Sources */, D83457411AFEE6050070616A /* SignalTests.swift in Sources */, 8295FD8D1B87374A007C9000 /* UIBarButtonItemTests.swift in Sources */, + 9D182ABA1D4584CC009985E5 /* UIPageControlTests.swift in Sources */, 8295FD871B87309F007C9000 /* UIControlTests.swift in Sources */, C7DCE2B71CB3C9D6001217D8 /* UITextViewTests.swift in Sources */, 5B7F81E41D0842B50014B06D /* UISegmentedControlTests.swift in Sources */, @@ -953,6 +963,7 @@ E6933BED1CD9C37D006F7CE7 /* UIProgressView.swift in Sources */, D8715DBF1C2112D6005F4191 /* NSData.swift in Sources */, D8715DCC1C211553005F4191 /* UIView.swift in Sources */, + 9D182AB81D4584AA009985E5 /* UIPageControl.swift in Sources */, D8715DBA1C2112D1005F4191 /* Action.swift in Sources */, D8715DC81C211553005F4191 /* UIButton.swift in Sources */, D8715DC71C211553005F4191 /* UIBarItem.swift in Sources */, @@ -973,6 +984,7 @@ 7D5FE3081CD4B04E00834675 /* UITextFieldTests.swift in Sources */, D8715DE21C211643005F4191 /* UIControlTests.swift in Sources */, CC02C18C1CCA704F0025CC04 /* ActionTests.swift in Sources */, + 9D182ABB1D4584CC009985E5 /* UIPageControlTests.swift in Sources */, D8715DDF1C21163B005F4191 /* NSObjectTests.swift in Sources */, 7DC3257E1CC6FD1C00746D88 /* UITableViewCellTests.swift in Sources */, D8715DDC1C211637005F4191 /* PropertyTests.swift in Sources */, @@ -1412,7 +1424,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - D8003E881AFEC3D400D7D3C5 /* Build configuration list for PBXProject "Rex-Mac" */ = { + D8003E881AFEC3D400D7D3C5 /* Build configuration list for PBXProject "Rex" */ = { isa = XCConfigurationList; buildConfigurations = ( D8003EA21AFEC3D400D7D3C5 /* Debug */, diff --git a/Tests/UIKit/UIPageControlTest.swift b/Tests/UIKit/UIPageControlTests.swift similarity index 97% rename from Tests/UIKit/UIPageControlTest.swift rename to Tests/UIKit/UIPageControlTests.swift index 06a5adb..925e66a 100644 --- a/Tests/UIKit/UIPageControlTest.swift +++ b/Tests/UIKit/UIPageControlTests.swift @@ -32,7 +32,7 @@ class UIPageControlTests: XCTestCase { XCTAssertTrue(pageControl.numberOfPages == 2) } - func testNumberOfPages() { + func testCurrentPage() { let pageControl = UIPageControl(frame: CGRectZero) _pageControl = pageControl From ecc76a0b50eabc19d88d2ee26137dd70df2820d1 Mon Sep 17 00:00:00 2001 From: Torsten Curdt Date: Mon, 25 Jul 2016 01:27:25 +0200 Subject: [PATCH 5/6] fixed the test --- Tests/UIKit/UIPageControlTests.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tests/UIKit/UIPageControlTests.swift b/Tests/UIKit/UIPageControlTests.swift index 925e66a..b1f7ea9 100644 --- a/Tests/UIKit/UIPageControlTests.swift +++ b/Tests/UIKit/UIPageControlTests.swift @@ -37,11 +37,12 @@ class UIPageControlTests: XCTestCase { _pageControl = pageControl let (pipeSignal, observer) = Signal.pipe() + pageControl.numberOfPages = 2 pageControl.rex_currentPage <~ SignalProducer(signal: pipeSignal) + observer.sendNext(0) + XCTAssertTrue(pageControl.currentPage == 0) observer.sendNext(1) XCTAssertTrue(pageControl.currentPage == 1) - observer.sendNext(2) - XCTAssertTrue(pageControl.currentPage == 2) } } From 82c6fd598d7321f2643bc2586eb73f1cb81ba259 Mon Sep 17 00:00:00 2001 From: Torsten Curdt Date: Mon, 1 Aug 2016 10:15:22 +0200 Subject: [PATCH 6/6] delegate to rex_value --- Source/UIKit/UIPageControl.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/UIKit/UIPageControl.swift b/Source/UIKit/UIPageControl.swift index 84e9413..811d057 100644 --- a/Source/UIKit/UIPageControl.swift +++ b/Source/UIKit/UIPageControl.swift @@ -18,9 +18,8 @@ extension UIPageControl { /// Wraps a page control's `currentPage` value in a bindable property. public var rex_currentPage: MutableProperty { - return associatedProperty(self, key: ¤tPageKey, initial: { $0.currentPage }, setter: { $0.currentPage = $1 }) + return UIControl.rex_value(self, getter: { $0.currentPage }, setter: { $0.currentPage = $1 }) } } private var numberOfPagesKey: UInt8 = 0 -private var currentPageKey: UInt8 = 0