diff --git a/ReactiveObjC.xcodeproj/project.pbxproj b/ReactiveObjC.xcodeproj/project.pbxproj index dfebb6eb1..9fb6b735d 100644 --- a/ReactiveObjC.xcodeproj/project.pbxproj +++ b/ReactiveObjC.xcodeproj/project.pbxproj @@ -574,8 +574,6 @@ D037663719EDA41200A782A9 /* UIDatePicker+RACSignalSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = D03764D119EDA41200A782A9 /* UIDatePicker+RACSignalSupport.m */; }; D037663919EDA41200A782A9 /* UIGestureRecognizer+RACSignalSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = D03764D219EDA41200A782A9 /* UIGestureRecognizer+RACSignalSupport.h */; settings = {ATTRIBUTES = (Public, ); }; }; D037663B19EDA41200A782A9 /* UIGestureRecognizer+RACSignalSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = D03764D319EDA41200A782A9 /* UIGestureRecognizer+RACSignalSupport.m */; }; - D037663D19EDA41200A782A9 /* UIImagePickerController+RACSignalSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = D03764D419EDA41200A782A9 /* UIImagePickerController+RACSignalSupport.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D037663F19EDA41200A782A9 /* UIImagePickerController+RACSignalSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = D03764D519EDA41200A782A9 /* UIImagePickerController+RACSignalSupport.m */; }; D037664119EDA41200A782A9 /* UIRefreshControl+RACCommandSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = D03764D619EDA41200A782A9 /* UIRefreshControl+RACCommandSupport.h */; settings = {ATTRIBUTES = (Public, ); }; }; D037664319EDA41200A782A9 /* UIRefreshControl+RACCommandSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = D03764D719EDA41200A782A9 /* UIRefreshControl+RACCommandSupport.m */; }; D037664519EDA41200A782A9 /* UISegmentedControl+RACSignalSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = D03764D819EDA41200A782A9 /* UISegmentedControl+RACSignalSupport.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -685,7 +683,6 @@ D037671C19EDA60000A782A9 /* UIAlertViewRACSupportSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D03766B319EDA60000A782A9 /* UIAlertViewRACSupportSpec.m */; }; D037671E19EDA60000A782A9 /* UIBarButtonItemRACSupportSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D03766B419EDA60000A782A9 /* UIBarButtonItemRACSupportSpec.m */; }; D037672019EDA60000A782A9 /* UIButtonRACSupportSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D03766B519EDA60000A782A9 /* UIButtonRACSupportSpec.m */; }; - D037672419EDA60000A782A9 /* UIImagePickerControllerRACSupportSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D03766B719EDA60000A782A9 /* UIImagePickerControllerRACSupportSpec.m */; }; D037672719EDA63400A782A9 /* RACBehaviorSubject.h in Headers */ = {isa = PBXBuildFile; fileRef = D037646019EDA41200A782A9 /* RACBehaviorSubject.h */; settings = {ATTRIBUTES = (Public, ); }; }; D037672819EDA63500A782A9 /* RACBehaviorSubject.h in Headers */ = {isa = PBXBuildFile; fileRef = D037646019EDA41200A782A9 /* RACBehaviorSubject.h */; settings = {ATTRIBUTES = (Public, ); }; }; D037672D19EDA75D00A782A9 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D037672B19EDA75D00A782A9 /* Quick.framework */; }; @@ -940,8 +937,6 @@ D03764D119EDA41200A782A9 /* UIDatePicker+RACSignalSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDatePicker+RACSignalSupport.m"; sourceTree = ""; }; D03764D219EDA41200A782A9 /* UIGestureRecognizer+RACSignalSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIGestureRecognizer+RACSignalSupport.h"; sourceTree = ""; }; D03764D319EDA41200A782A9 /* UIGestureRecognizer+RACSignalSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIGestureRecognizer+RACSignalSupport.m"; sourceTree = ""; }; - D03764D419EDA41200A782A9 /* UIImagePickerController+RACSignalSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImagePickerController+RACSignalSupport.h"; sourceTree = ""; }; - D03764D519EDA41200A782A9 /* UIImagePickerController+RACSignalSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImagePickerController+RACSignalSupport.m"; sourceTree = ""; }; D03764D619EDA41200A782A9 /* UIRefreshControl+RACCommandSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIRefreshControl+RACCommandSupport.h"; sourceTree = ""; }; D03764D719EDA41200A782A9 /* UIRefreshControl+RACCommandSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIRefreshControl+RACCommandSupport.m"; sourceTree = ""; }; D03764D819EDA41200A782A9 /* UISegmentedControl+RACSignalSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UISegmentedControl+RACSignalSupport.h"; sourceTree = ""; }; @@ -1017,7 +1012,6 @@ D03766B319EDA60000A782A9 /* UIAlertViewRACSupportSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAlertViewRACSupportSpec.m; sourceTree = ""; }; D03766B419EDA60000A782A9 /* UIBarButtonItemRACSupportSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIBarButtonItemRACSupportSpec.m; sourceTree = ""; }; D03766B519EDA60000A782A9 /* UIButtonRACSupportSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIButtonRACSupportSpec.m; sourceTree = ""; }; - D03766B719EDA60000A782A9 /* UIImagePickerControllerRACSupportSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImagePickerControllerRACSupportSpec.m; sourceTree = ""; }; D037672B19EDA75D00A782A9 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Quick.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D04725EA19E49ED7006002AA /* ReactiveObjC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReactiveObjC.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D04725EE19E49ED7006002AA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -1350,8 +1344,6 @@ D03764D119EDA41200A782A9 /* UIDatePicker+RACSignalSupport.m */, D03764D219EDA41200A782A9 /* UIGestureRecognizer+RACSignalSupport.h */, D03764D319EDA41200A782A9 /* UIGestureRecognizer+RACSignalSupport.m */, - D03764D419EDA41200A782A9 /* UIImagePickerController+RACSignalSupport.h */, - D03764D519EDA41200A782A9 /* UIImagePickerController+RACSignalSupport.m */, D03764D619EDA41200A782A9 /* UIRefreshControl+RACCommandSupport.h */, D03764D719EDA41200A782A9 /* UIRefreshControl+RACCommandSupport.m */, D03764D819EDA41200A782A9 /* UISegmentedControl+RACSignalSupport.h */, @@ -1438,7 +1430,6 @@ D03766B319EDA60000A782A9 /* UIAlertViewRACSupportSpec.m */, D03766B419EDA60000A782A9 /* UIBarButtonItemRACSupportSpec.m */, D03766B519EDA60000A782A9 /* UIButtonRACSupportSpec.m */, - D03766B719EDA60000A782A9 /* UIImagePickerControllerRACSupportSpec.m */, D0C3131719EF2D9700984962 /* RACTestExampleScheduler.h */, D0C3131819EF2D9700984962 /* RACTestExampleScheduler.m */, D0C3131919EF2D9700984962 /* RACTestObject.h */, @@ -1729,7 +1720,6 @@ D037660119EDA41200A782A9 /* RACTestScheduler.h in Headers */, D03765A319EDA41200A782A9 /* RACMulticastConnection.h in Headers */, D03765B719EDA41200A782A9 /* RACReplaySubject.h in Headers */, - D037663D19EDA41200A782A9 /* UIImagePickerController+RACSignalSupport.h in Headers */, D037656F19EDA41200A782A9 /* RACDisposable.h in Headers */, 314304171ACA8B1E00595017 /* MKAnnotationView+RACSignalSupport.h in Headers */, D037654519EDA41200A782A9 /* NSURLConnection+RACSupport.h in Headers */, @@ -2410,7 +2400,6 @@ D03765ED19EDA41200A782A9 /* RACSubject.m in Sources */, D037664F19EDA41200A782A9 /* UIStepper+RACSignalSupport.m in Sources */, D03765D119EDA41200A782A9 /* RACSerialDisposable.m in Sources */, - D037663F19EDA41200A782A9 /* UIImagePickerController+RACSignalSupport.m in Sources */, D037653F19EDA41200A782A9 /* NSString+RACSupport.m in Sources */, D037653719EDA41200A782A9 /* NSString+RACKeyPathUtilities.m in Sources */, D03764FB19EDA41200A782A9 /* NSDictionary+RACSequenceAdditions.m in Sources */, @@ -2487,7 +2476,6 @@ buildActionMask = 2147483647; files = ( D03766C819EDA60000A782A9 /* NSObjectRACPropertySubscribingExamples.m in Sources */, - D037672419EDA60000A782A9 /* UIImagePickerControllerRACSupportSpec.m in Sources */, D03766E419EDA60000A782A9 /* RACDelegateProxySpec.m in Sources */, D03766FA19EDA60000A782A9 /* RACSerialDisposableSpec.m in Sources */, D037670C19EDA60000A782A9 /* RACTargetQueueSchedulerSpec.m in Sources */, diff --git a/ReactiveObjC/ReactiveObjC.h b/ReactiveObjC/ReactiveObjC.h index 6defe8aa8..f967ecf6f 100644 --- a/ReactiveObjC/ReactiveObjC.h +++ b/ReactiveObjC/ReactiveObjC.h @@ -81,7 +81,6 @@ FOUNDATION_EXPORT const unsigned char ReactiveObjCVersionString[]; #import #import #import - #import #import #import #import diff --git a/ReactiveObjC/UIImagePickerController+RACSignalSupport.h b/ReactiveObjC/UIImagePickerController+RACSignalSupport.h deleted file mode 100644 index 7cce9bc46..000000000 --- a/ReactiveObjC/UIImagePickerController+RACSignalSupport.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// UIImagePickerController+RACSignalSupport.h -// ReactiveObjC -// -// Created by Timur Kuchkarov on 28.03.14. -// Copyright (c) 2014 GitHub. All rights reserved. -// - -#import - -@class RACDelegateProxy; -@class RACSignal<__covariant ValueType>; - -NS_ASSUME_NONNULL_BEGIN - -@interface UIImagePickerController (RACSignalSupport) - -/// A delegate proxy which will be set as the receiver's delegate when any of the -/// methods in this category are used. -@property (nonatomic, strong, readonly) RACDelegateProxy *rac_delegateProxy; - -/// Creates a signal for every new selected image. -/// -/// When this method is invoked, the `rac_delegateProxy` will become the -/// receiver's delegate. Any previous delegate will become the -[RACDelegateProxy -/// rac_proxiedDelegate], so that it receives any messages that the proxy doesn't -/// know how to handle. Setting the receiver's `delegate` afterward is considered -/// undefined behavior. -/// -/// Returns a signal which will send the dictionary with info for the selected image. -/// Caller is responsible for picker controller dismissal. The signal will complete -/// itself when the receiver is deallocated or when user cancels selection. -- (RACSignal *)rac_imageSelectedSignal; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ReactiveObjC/UIImagePickerController+RACSignalSupport.m b/ReactiveObjC/UIImagePickerController+RACSignalSupport.m deleted file mode 100644 index a5df4eec7..000000000 --- a/ReactiveObjC/UIImagePickerController+RACSignalSupport.m +++ /dev/null @@ -1,53 +0,0 @@ -// -// UIImagePickerController+RACSignalSupport.m -// ReactiveObjC -// -// Created by Timur Kuchkarov on 28.03.14. -// Copyright (c) 2014 GitHub. All rights reserved. -// - -#import "UIImagePickerController+RACSignalSupport.h" -#import "RACDelegateProxy.h" -#import "RACSignal+Operations.h" -#import "NSObject+RACDeallocating.h" -#import "NSObject+RACDescription.h" -#import - -@implementation UIImagePickerController (RACSignalSupport) - -static void RACUseDelegateProxy(UIImagePickerController *self) { - if (self.delegate == self.rac_delegateProxy) return; - - self.rac_delegateProxy.rac_proxiedDelegate = self.delegate; - self.delegate = (id)self.rac_delegateProxy; -} - -- (RACDelegateProxy *)rac_delegateProxy { - RACDelegateProxy *proxy = objc_getAssociatedObject(self, _cmd); - if (proxy == nil) { - proxy = [[RACDelegateProxy alloc] initWithProtocol:@protocol(UIImagePickerControllerDelegate)]; - objc_setAssociatedObject(self, _cmd, proxy, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } - - return proxy; -} - -- (RACSignal *)rac_imageSelectedSignal { - RACSignal *pickerCancelledSignal = [[self.rac_delegateProxy - signalForSelector:@selector(imagePickerControllerDidCancel:)] - merge:self.rac_willDeallocSignal]; - - RACSignal *imagePickerSignal = [[[[self.rac_delegateProxy - signalForSelector:@selector(imagePickerController:didFinishPickingMediaWithInfo:)] - reduceEach:^(UIImagePickerController *pickerController, NSDictionary *userInfo) { - return userInfo; - }] - takeUntil:pickerCancelledSignal] - setNameWithFormat:@"%@ -rac_imageSelectedSignal", RACDescription(self)]; - - RACUseDelegateProxy(self); - - return imagePickerSignal; -} - -@end diff --git a/ReactiveObjCTests/UIImagePickerControllerRACSupportSpec.m b/ReactiveObjCTests/UIImagePickerControllerRACSupportSpec.m deleted file mode 100644 index 9ecc1536b..000000000 --- a/ReactiveObjCTests/UIImagePickerControllerRACSupportSpec.m +++ /dev/null @@ -1,54 +0,0 @@ -// -// UIImagePickerControllerRACSupportSpec.m -// ReactiveObjC -// -// Created by Timur Kuchkarov on 17.04.14. -// Copyright (c) 2014 GitHub, Inc. All rights reserved. -// - -@import Quick; -@import Nimble; - -#import "UIImagePickerController+RACSignalSupport.h" -#import "RACSignal.h" - -QuickSpecBegin(UIImagePickerControllerRACSupportSpec) - -qck_describe(@"UIImagePickerController", ^{ - __block UIImagePickerController *imagePicker; - - qck_beforeEach(^{ - imagePicker = [[UIImagePickerController alloc] init]; - expect(imagePicker).notTo(beNil()); - }); - - qck_it(@"sends the user info dictionary after confirmation", ^{ - __block NSDictionary *selectedImageUserInfo = nil; - [imagePicker.rac_imageSelectedSignal subscribeNext:^(NSDictionary *userInfo) { - selectedImageUserInfo = userInfo; - }]; - - NSDictionary *info = @{ - UIImagePickerControllerMediaType: @"public.image", - UIImagePickerControllerMediaMetadata: @{} - }; - [imagePicker.delegate imagePickerController:imagePicker didFinishPickingMediaWithInfo:info]; - expect(selectedImageUserInfo).to(equal(info)); - }); - - qck_it(@"cancels image picking process", ^{ - __block BOOL didSend = NO; - __block BOOL didComplete = NO; - [imagePicker.rac_imageSelectedSignal subscribeNext:^(NSDictionary *userInfo) { - didSend = YES; - } completed:^{ - didComplete = YES; - }]; - - [imagePicker.delegate imagePickerControllerDidCancel:imagePicker]; - expect(@(didSend)).to(beFalsy()); - expect(@(didComplete)).to(beTruthy()); - }); -}); - -QuickSpecEnd