diff --git a/.circleci/config.yml b/.circleci/config.yml index 9cfe4f4d1..1707f3282 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: macos: - xcode: "10.0.0" + xcode: "12.0.0" steps: - checkout diff --git a/Cartfile.private b/Cartfile.private index 041fc496d..85fed33f2 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,3 +1,3 @@ github "jspahrsummers/xcconfigs" "3d9d996" -github "Quick/Quick" ~> 1.3.2 -github "Quick/Nimble" ~> 7.3.1 +github "Quick/Quick" ~> 3.0.0 +github "Quick/Nimble" ~> 8.1.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index 097bc11e7..1a8c2d6d1 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ -github "Quick/Nimble" "v7.3.1" -github "Quick/Quick" "v1.3.2" +github "Quick/Nimble" "v8.1.1" +github "Quick/Quick" "v3.0.0" github "jspahrsummers/xcconfigs" "3d9d99634cae6d586e272543d527681283b33eb0" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index cd6dfb86f..2b1809051 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit cd6dfb86f496fcd96ce0bc6da962cd936bf41903 +Subproject commit 2b1809051b4a65c1d7f5233331daa24572cd7fca diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index 5fbf13871..0038bcbab 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit 5fbf13871d185526993130c3a1fad0b70bfe37ce +Subproject commit 0038bcbab4292f3b028632556507c124e5ba69f3 diff --git a/ReactiveObjC.xcodeproj/project.pbxproj b/ReactiveObjC.xcodeproj/project.pbxproj index e91adfe13..fa4eeec75 100644 --- a/ReactiveObjC.xcodeproj/project.pbxproj +++ b/ReactiveObjC.xcodeproj/project.pbxproj @@ -568,10 +568,6 @@ D037661319EDA41200A782A9 /* RACUnit.m in Sources */ = {isa = PBXBuildFile; fileRef = D03764BF19EDA41200A782A9 /* RACUnit.m */; }; D037661619EDA41200A782A9 /* RACValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = D03764C119EDA41200A782A9 /* RACValueTransformer.m */; }; D037661719EDA41200A782A9 /* RACValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = D03764C119EDA41200A782A9 /* RACValueTransformer.m */; }; - D037661919EDA41200A782A9 /* UIActionSheet+RACSignalSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = D03764C219EDA41200A782A9 /* UIActionSheet+RACSignalSupport.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D037661B19EDA41200A782A9 /* UIActionSheet+RACSignalSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = D03764C319EDA41200A782A9 /* UIActionSheet+RACSignalSupport.m */; }; - D037661D19EDA41200A782A9 /* UIAlertView+RACSignalSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = D03764C419EDA41200A782A9 /* UIAlertView+RACSignalSupport.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D037661F19EDA41200A782A9 /* UIAlertView+RACSignalSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = D03764C519EDA41200A782A9 /* UIAlertView+RACSignalSupport.m */; }; D037662119EDA41200A782A9 /* UIBarButtonItem+RACCommandSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = D03764C619EDA41200A782A9 /* UIBarButtonItem+RACCommandSupport.h */; settings = {ATTRIBUTES = (Public, ); }; }; D037662319EDA41200A782A9 /* UIBarButtonItem+RACCommandSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = D03764C719EDA41200A782A9 /* UIBarButtonItem+RACCommandSupport.m */; }; D037662519EDA41200A782A9 /* UIButton+RACCommandSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = D03764C819EDA41200A782A9 /* UIButton+RACCommandSupport.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -692,8 +688,6 @@ D037671619EDA60000A782A9 /* RACTupleSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D03766B019EDA60000A782A9 /* RACTupleSpec.m */; }; D037671719EDA60000A782A9 /* test-data.json in Resources */ = {isa = PBXBuildFile; fileRef = D03766B119EDA60000A782A9 /* test-data.json */; }; D037671819EDA60000A782A9 /* test-data.json in Resources */ = {isa = PBXBuildFile; fileRef = D03766B119EDA60000A782A9 /* test-data.json */; }; - D037671A19EDA60000A782A9 /* UIActionSheetRACSupportSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D03766B219EDA60000A782A9 /* UIActionSheetRACSupportSpec.m */; }; - 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 */; }; @@ -938,10 +932,6 @@ D03764BF19EDA41200A782A9 /* RACUnit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACUnit.m; sourceTree = ""; }; D03764C019EDA41200A782A9 /* RACValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACValueTransformer.h; sourceTree = ""; }; D03764C119EDA41200A782A9 /* RACValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACValueTransformer.m; sourceTree = ""; }; - D03764C219EDA41200A782A9 /* UIActionSheet+RACSignalSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIActionSheet+RACSignalSupport.h"; sourceTree = ""; }; - D03764C319EDA41200A782A9 /* UIActionSheet+RACSignalSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIActionSheet+RACSignalSupport.m"; sourceTree = ""; }; - D03764C419EDA41200A782A9 /* UIAlertView+RACSignalSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIAlertView+RACSignalSupport.h"; sourceTree = ""; }; - D03764C519EDA41200A782A9 /* UIAlertView+RACSignalSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIAlertView+RACSignalSupport.m"; sourceTree = ""; }; D03764C619EDA41200A782A9 /* UIBarButtonItem+RACCommandSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+RACCommandSupport.h"; sourceTree = ""; }; D03764C719EDA41200A782A9 /* UIBarButtonItem+RACCommandSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBarButtonItem+RACCommandSupport.m"; sourceTree = ""; }; D03764C819EDA41200A782A9 /* UIButton+RACCommandSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+RACCommandSupport.h"; sourceTree = ""; }; @@ -1029,8 +1019,6 @@ D03766A819EDA60000A782A9 /* RACTargetQueueSchedulerSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACTargetQueueSchedulerSpec.m; sourceTree = ""; }; D03766B019EDA60000A782A9 /* RACTupleSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACTupleSpec.m; sourceTree = ""; }; D03766B119EDA60000A782A9 /* test-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "test-data.json"; sourceTree = ""; }; - D03766B219EDA60000A782A9 /* UIActionSheetRACSupportSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIActionSheetRACSupportSpec.m; sourceTree = ""; }; - 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 = ""; }; @@ -1363,10 +1351,6 @@ D03764C119EDA41200A782A9 /* RACValueTransformer.m */, D04725EF19E49ED7006002AA /* ReactiveObjC.h */, D04725ED19E49ED7006002AA /* Supporting Files */, - D03764C219EDA41200A782A9 /* UIActionSheet+RACSignalSupport.h */, - D03764C319EDA41200A782A9 /* UIActionSheet+RACSignalSupport.m */, - D03764C419EDA41200A782A9 /* UIAlertView+RACSignalSupport.h */, - D03764C519EDA41200A782A9 /* UIAlertView+RACSignalSupport.m */, D03764C619EDA41200A782A9 /* UIBarButtonItem+RACCommandSupport.h */, D03764C719EDA41200A782A9 /* UIBarButtonItem+RACCommandSupport.m */, D03764C819EDA41200A782A9 /* UIButton+RACCommandSupport.h */, @@ -1465,8 +1449,6 @@ D03766A719EDA60000A782A9 /* RACSubscriptingAssignmentTrampolineSpec.m */, D03766A819EDA60000A782A9 /* RACTargetQueueSchedulerSpec.m */, D03766B019EDA60000A782A9 /* RACTupleSpec.m */, - D03766B219EDA60000A782A9 /* UIActionSheetRACSupportSpec.m */, - D03766B319EDA60000A782A9 /* UIAlertViewRACSupportSpec.m */, D03766B419EDA60000A782A9 /* UIBarButtonItemRACSupportSpec.m */, D03766B519EDA60000A782A9 /* UIButtonRACSupportSpec.m */, D03766B719EDA60000A782A9 /* UIImagePickerControllerRACSupportSpec.m */, @@ -1768,7 +1750,6 @@ D037656F19EDA41200A782A9 /* RACDisposable.h in Headers */, 314304171ACA8B1E00595017 /* MKAnnotationView+RACSignalSupport.h in Headers */, D037654519EDA41200A782A9 /* NSURLConnection+RACSupport.h in Headers */, - D037661D19EDA41200A782A9 /* UIAlertView+RACSignalSupport.h in Headers */, D037650D19EDA41200A782A9 /* NSNotificationCenter+RACSupport.h in Headers */, D037650119EDA41200A782A9 /* NSFileHandle+RACSupport.h in Headers */, D037666119EDA41200A782A9 /* UITextView+RACSignalSupport.h in Headers */, @@ -1818,7 +1799,6 @@ A1046B7B1BFF5662004D8045 /* EXTRuntimeExtensions.h in Headers */, D037661119EDA41200A782A9 /* RACUnit.h in Headers */, D03765FD19EDA41200A782A9 /* RACTargetQueueScheduler.h in Headers */, - D037661919EDA41200A782A9 /* UIActionSheet+RACSignalSupport.h in Headers */, D037664D19EDA41200A782A9 /* UIStepper+RACSignalSupport.h in Headers */, D037662119EDA41200A782A9 /* UIBarButtonItem+RACCommandSupport.h in Headers */, D03765EB19EDA41200A782A9 /* RACSubject.h in Headers */, @@ -2441,7 +2421,6 @@ D037662B19EDA41200A782A9 /* UICollectionReusableView+RACSignalSupport.m in Sources */, D037659919EDA41200A782A9 /* RACIndexSetSequence.m in Sources */, D03765D919EDA41200A782A9 /* RACSignal+Operations.m in Sources */, - D037661B19EDA41200A782A9 /* UIActionSheet+RACSignalSupport.m in Sources */, D037650319EDA41200A782A9 /* NSFileHandle+RACSupport.m in Sources */, D03765E319EDA41200A782A9 /* RACStream.m in Sources */, D037655719EDA41200A782A9 /* RACBehaviorSubject.m in Sources */, @@ -2457,7 +2436,6 @@ D03764FB19EDA41200A782A9 /* NSDictionary+RACSequenceAdditions.m in Sources */, D037656919EDA41200A782A9 /* RACCompoundDisposableProvider.d in Sources */, D037653B19EDA41200A782A9 /* NSString+RACSequenceAdditions.m in Sources */, - D037661F19EDA41200A782A9 /* UIAlertView+RACSignalSupport.m in Sources */, D03765E919EDA41200A782A9 /* RACStringSequence.m in Sources */, D037660B19EDA41200A782A9 /* RACTupleSequence.m in Sources */, D03765D519EDA41200A782A9 /* RACSignal.m in Sources */, @@ -2556,7 +2534,6 @@ D0C3132119EF2D9700984962 /* RACTestObject.m in Sources */, D03766FC19EDA60000A782A9 /* RACSignalSpec.m in Sources */, D037670819EDA60000A782A9 /* RACSubscriberSpec.m in Sources */, - D037671C19EDA60000A782A9 /* UIAlertViewRACSupportSpec.m in Sources */, D03766F019EDA60000A782A9 /* RACPropertySignalExamples.m in Sources */, D037670619EDA60000A782A9 /* RACSubscriberExamples.m in Sources */, D03766D819EDA60000A782A9 /* RACBlockTrampolineSpec.m in Sources */, @@ -2570,7 +2547,6 @@ D03766E619EDA60000A782A9 /* RACDisposableSpec.m in Sources */, D03766D419EDA60000A782A9 /* NSUserDefaultsRACSupportSpec.m in Sources */, D03766DC19EDA60000A782A9 /* RACChannelSpec.m in Sources */, - D037671A19EDA60000A782A9 /* UIActionSheetRACSupportSpec.m in Sources */, D03766DA19EDA60000A782A9 /* RACChannelExamples.m in Sources */, 8B33C24021CBD31800BB82D2 /* RACNeverSignalSpec.m in Sources */, D03766F619EDA60000A782A9 /* RACSequenceExamples.m in Sources */, @@ -2790,17 +2766,18 @@ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGNING_REQUIRED = NO; CURRENT_PROJECT_VERSION = 1; ENABLE_TESTABILITY = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.reactivecocoa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(PROJECT_NAME)"; RUN_CLANG_STATIC_ANALYZER = NO; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 12.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WARNING_CFLAGS = ( @@ -2824,12 +2801,12 @@ CODE_SIGNING_REQUIRED = NO; CURRENT_PROJECT_VERSION = 1; GCC_OPTIMIZATION_LEVEL = 0; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.reactivecocoa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(PROJECT_NAME)"; RUN_CLANG_STATIC_ANALYZER = NO; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 12.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WARNING_CFLAGS = ( @@ -2927,6 +2904,7 @@ baseConfigurationReference = D047263219E49FE8006002AA /* iOS-Application.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; INFOPLIST_FILE = ReactiveObjCTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; @@ -2952,16 +2930,17 @@ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGNING_REQUIRED = NO; CURRENT_PROJECT_VERSION = 1; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.reactivecocoa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(PROJECT_NAME)"; RUN_CLANG_STATIC_ANALYZER = NO; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 12.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WARNING_CFLAGS = ( @@ -3036,12 +3015,12 @@ CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGNING_REQUIRED = NO; CURRENT_PROJECT_VERSION = 1; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_BUNDLE_IDENTIFIER = "org.reactivecocoa.$(PRODUCT_NAME:rfc1034identifier)-Tests"; PRODUCT_NAME = "$(PROJECT_NAME)"; RUN_CLANG_STATIC_ANALYZER = NO; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 12.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WARNING_CFLAGS = ( diff --git a/ReactiveObjC/NSObject+RACPropertySubscribing.h b/ReactiveObjC/NSObject+RACPropertySubscribing.h index 3c055b129..f88c10d87 100644 --- a/ReactiveObjC/NSObject+RACPropertySubscribing.h +++ b/ReactiveObjC/NSObject+RACPropertySubscribing.h @@ -8,7 +8,7 @@ #import #import -#import "metamacros.h" +#import /// Creates a signal which observes `KEYPATH` on `TARGET` for changes. /// diff --git a/ReactiveObjC/NSObject+RACPropertySubscribing.m b/ReactiveObjC/NSObject+RACPropertySubscribing.m index dbede782c..12c840215 100644 --- a/ReactiveObjC/NSObject+RACPropertySubscribing.m +++ b/ReactiveObjC/NSObject+RACPropertySubscribing.m @@ -17,7 +17,6 @@ #import "RACSubscriber.h" #import "RACSignal+Operations.h" #import "RACTuple.h" -#import @implementation NSObject (RACPropertySubscribing) diff --git a/ReactiveObjC/RACBehaviorSubject.h b/ReactiveObjC/RACBehaviorSubject.h index a462656eb..77f31fa27 100644 --- a/ReactiveObjC/RACBehaviorSubject.h +++ b/ReactiveObjC/RACBehaviorSubject.h @@ -6,7 +6,7 @@ // Copyright (c) 2012 GitHub, Inc. All rights reserved. // -#import "RACSubject.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACChannel.h b/ReactiveObjC/RACChannel.h index 847f17439..845d5ee34 100644 --- a/ReactiveObjC/RACChannel.h +++ b/ReactiveObjC/RACChannel.h @@ -6,8 +6,8 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import "RACSignal.h" -#import "RACSubscriber.h" +#import +#import @class RACChannelTerminal; diff --git a/ReactiveObjC/RACCommand.m b/ReactiveObjC/RACCommand.m index 9377fb33b..affc364b5 100644 --- a/ReactiveObjC/RACCommand.m +++ b/ReactiveObjC/RACCommand.m @@ -17,7 +17,7 @@ #import "RACScheduler.h" #import "RACSequence.h" #import "RACSignal+Operations.h" -#import +#import NSString * const RACCommandErrorDomain = @"RACCommandErrorDomain"; NSString * const RACUnderlyingCommandErrorKey = @"RACUnderlyingCommandErrorKey"; @@ -26,7 +26,7 @@ @interface RACCommand () { // Atomic backing variable for `allowsConcurrentExecution`. - volatile uint32_t _allowsConcurrentExecution; + atomic_bool _allowsConcurrentExecution; } /// A subject that sends added execution signals. @@ -55,9 +55,9 @@ - (BOOL)allowsConcurrentExecution { - (void)setAllowsConcurrentExecution:(BOOL)allowed { if (allowed) { - OSAtomicOr32Barrier(1, &_allowsConcurrentExecution); + _allowsConcurrentExecution = true; } else { - OSAtomicAnd32Barrier(0, &_allowsConcurrentExecution); + _allowsConcurrentExecution = false; } [self.allowsConcurrentExecutionSubject sendNext:@(_allowsConcurrentExecution)]; diff --git a/ReactiveObjC/RACCompoundDisposable.h b/ReactiveObjC/RACCompoundDisposable.h index b4e4dea33..77b829497 100644 --- a/ReactiveObjC/RACCompoundDisposable.h +++ b/ReactiveObjC/RACCompoundDisposable.h @@ -6,7 +6,7 @@ // Copyright (c) 2012 GitHub, Inc. All rights reserved. // -#import "RACDisposable.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACDisposable.m b/ReactiveObjC/RACDisposable.m index 9a6ef2c96..3f62a9747 100644 --- a/ReactiveObjC/RACDisposable.m +++ b/ReactiveObjC/RACDisposable.m @@ -8,7 +8,7 @@ #import "RACDisposable.h" #import "RACScopedDisposable.h" -#import +#import @interface RACDisposable () { // A copied block of type void (^)(void) containing the logic for disposal, @@ -16,7 +16,7 @@ @interface RACDisposable () { // NULL if the receiver is already disposed. // // This should only be used atomically. - void * volatile _disposeBlock; + _Atomic(void *) _disposeBlock; } @end @@ -35,7 +35,7 @@ - (instancetype)init { self = [super init]; _disposeBlock = (__bridge void *)self; - OSMemoryBarrier(); + atomic_thread_fence(memory_order_seq_cst); return self; } @@ -45,8 +45,8 @@ - (instancetype)initWithBlock:(void (^)(void))block { self = [super init]; - _disposeBlock = (void *)CFBridgingRetain([block copy]); - OSMemoryBarrier(); + _disposeBlock = (void *)CFBridgingRetain([block copy]); + atomic_thread_fence(memory_order_seq_cst); return self; } @@ -69,7 +69,7 @@ - (void)dispose { while (YES) { void *blockPtr = _disposeBlock; - if (OSAtomicCompareAndSwapPtrBarrier(blockPtr, NULL, &_disposeBlock)) { + if (atomic_compare_exchange_strong(&_disposeBlock, &blockPtr, NULL)) { if (blockPtr != (__bridge void *)self) { disposeBlock = CFBridgingRelease(blockPtr); } diff --git a/ReactiveObjC/RACDynamicSequence.m b/ReactiveObjC/RACDynamicSequence.m index 2e8f290aa..956f555ce 100644 --- a/ReactiveObjC/RACDynamicSequence.m +++ b/ReactiveObjC/RACDynamicSequence.m @@ -7,7 +7,7 @@ // #import "RACDynamicSequence.h" -#import +#import // Determines how RACDynamicSequences will be deallocated before the next one is // shifted onto the autorelease pool. @@ -114,10 +114,10 @@ + (RACSequence *)sequenceWithLazyDependency:(id (^)(void))dependencyBlock headBl } - (void)dealloc { - static volatile int32_t directDeallocCount = 0; + static atomic_int directDeallocCount = 0; - if (OSAtomicIncrement32(&directDeallocCount) >= DEALLOC_OVERFLOW_GUARD) { - OSAtomicAdd32(-DEALLOC_OVERFLOW_GUARD, &directDeallocCount); + if (atomic_fetch_add(&directDeallocCount, 1) + 1 >= DEALLOC_OVERFLOW_GUARD) { + atomic_fetch_add(&directDeallocCount, -DEALLOC_OVERFLOW_GUARD); // Put this sequence's tail onto the autorelease pool so we stop // recursing. diff --git a/ReactiveObjC/RACDynamicSignal.m b/ReactiveObjC/RACDynamicSignal.m index 718da6624..ce2434fb8 100644 --- a/ReactiveObjC/RACDynamicSignal.m +++ b/ReactiveObjC/RACDynamicSignal.m @@ -12,7 +12,6 @@ #import "RACPassthroughSubscriber.h" #import "RACScheduler+Private.h" #import "RACSubscriber.h" -#import @interface RACDynamicSignal () diff --git a/ReactiveObjC/RACGroupedSignal.h b/ReactiveObjC/RACGroupedSignal.h index 06680762e..eb4925732 100644 --- a/ReactiveObjC/RACGroupedSignal.h +++ b/ReactiveObjC/RACGroupedSignal.h @@ -6,7 +6,7 @@ // Copyright (c) 2012 GitHub, Inc. All rights reserved. // -#import "RACSubject.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACKVOChannel.h b/ReactiveObjC/RACKVOChannel.h index bfbb212ee..2fd22e046 100644 --- a/ReactiveObjC/RACKVOChannel.h +++ b/ReactiveObjC/RACKVOChannel.h @@ -6,9 +6,9 @@ // Copyright (c) 2012 GitHub, Inc. All rights reserved. // -#import "RACChannel.h" +#import #import -#import "metamacros.h" +#import /// Creates a RACKVOChannel to the given key path. When the targeted object /// deallocates, the channel will complete. diff --git a/ReactiveObjC/RACMulticastConnection.h b/ReactiveObjC/RACMulticastConnection.h index 7b7dbf822..b2137924d 100644 --- a/ReactiveObjC/RACMulticastConnection.h +++ b/ReactiveObjC/RACMulticastConnection.h @@ -7,7 +7,7 @@ // #import -#import "RACAnnotations.h" +#import @class RACDisposable; @class RACSignal<__covariant ValueType>; diff --git a/ReactiveObjC/RACMulticastConnection.m b/ReactiveObjC/RACMulticastConnection.m index 35e98dd71..c56cb9a54 100644 --- a/ReactiveObjC/RACMulticastConnection.m +++ b/ReactiveObjC/RACMulticastConnection.m @@ -11,7 +11,7 @@ #import "RACDisposable.h" #import "RACSerialDisposable.h" #import "RACSubject.h" -#import +#import @interface RACMulticastConnection () { RACSubject *_signal; @@ -24,7 +24,7 @@ @interface RACMulticastConnection () { // // If the swap is unsuccessful it means that `_sourceSignal` has already been // connected and the caller has no action to take. - int32_t volatile _hasConnected; + _Atomic(BOOL) _hasConnected; } @property (nonatomic, readonly, strong) RACSignal *sourceSignal; @@ -51,7 +51,8 @@ - (instancetype)initWithSourceSignal:(RACSignal *)source subject:(RACSubject *)s #pragma mark Connecting - (RACDisposable *)connect { - BOOL shouldConnect = OSAtomicCompareAndSwap32Barrier(0, 1, &_hasConnected); + BOOL expected = NO; + BOOL shouldConnect = atomic_compare_exchange_strong(&_hasConnected, &expected, YES); if (shouldConnect) { self.serialDisposable.disposable = [self.sourceSignal subscribe:_signal]; @@ -61,11 +62,11 @@ - (RACDisposable *)connect { } - (RACSignal *)autoconnect { - __block volatile int32_t subscriberCount = 0; + __block atomic_int subscriberCount = 0; return [[RACSignal createSignal:^(id subscriber) { - OSAtomicIncrement32Barrier(&subscriberCount); + atomic_fetch_add(&subscriberCount, 1); RACDisposable *subscriptionDisposable = [self.signal subscribe:subscriber]; RACDisposable *connectionDisposable = [self connect]; @@ -73,7 +74,7 @@ - (RACSignal *)autoconnect { return [RACDisposable disposableWithBlock:^{ [subscriptionDisposable dispose]; - if (OSAtomicDecrement32Barrier(&subscriberCount) == 0) { + if (atomic_fetch_sub(&subscriberCount, 1) - 1 == 0) { [connectionDisposable dispose]; } }]; diff --git a/ReactiveObjC/RACQueueScheduler+Subclass.h b/ReactiveObjC/RACQueueScheduler+Subclass.h index 74c45868e..19a5ba394 100644 --- a/ReactiveObjC/RACQueueScheduler+Subclass.h +++ b/ReactiveObjC/RACQueueScheduler+Subclass.h @@ -6,8 +6,8 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import "RACQueueScheduler.h" -#import "RACScheduler+Subclass.h" +#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACQueueScheduler.h b/ReactiveObjC/RACQueueScheduler.h index 3b317b0a3..d00721015 100644 --- a/ReactiveObjC/RACQueueScheduler.h +++ b/ReactiveObjC/RACQueueScheduler.h @@ -6,7 +6,7 @@ // Copyright (c) 2012 GitHub, Inc. All rights reserved. // -#import "RACScheduler.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACReplaySubject.h b/ReactiveObjC/RACReplaySubject.h index b82c8a067..75aff7b83 100644 --- a/ReactiveObjC/RACReplaySubject.h +++ b/ReactiveObjC/RACReplaySubject.h @@ -6,7 +6,7 @@ // Copyright (c) 2012 GitHub, Inc. All rights reserved. // -#import "RACSubject.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACScheduler+Subclass.h b/ReactiveObjC/RACScheduler+Subclass.h index 34d10377f..b0d3fa21a 100644 --- a/ReactiveObjC/RACScheduler+Subclass.h +++ b/ReactiveObjC/RACScheduler+Subclass.h @@ -7,7 +7,7 @@ // #import -#import "RACScheduler.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACScopedDisposable.h b/ReactiveObjC/RACScopedDisposable.h index ff1067ce2..7db759387 100644 --- a/ReactiveObjC/RACScopedDisposable.h +++ b/ReactiveObjC/RACScopedDisposable.h @@ -6,7 +6,7 @@ // Copyright (c) 2012 GitHub, Inc. All rights reserved. // -#import "RACDisposable.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACSequence.h b/ReactiveObjC/RACSequence.h index c7bc6b9a9..43e5b960f 100644 --- a/ReactiveObjC/RACSequence.h +++ b/ReactiveObjC/RACSequence.h @@ -7,7 +7,7 @@ // #import -#import "RACStream.h" +#import @class RACTuple; @class RACScheduler; diff --git a/ReactiveObjC/RACSerialDisposable.h b/ReactiveObjC/RACSerialDisposable.h index c45fb7565..f2df7a0ce 100644 --- a/ReactiveObjC/RACSerialDisposable.h +++ b/ReactiveObjC/RACSerialDisposable.h @@ -6,7 +6,7 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import "RACDisposable.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACSignal+Operations.h b/ReactiveObjC/RACSignal+Operations.h index 1a939db72..c0170845b 100644 --- a/ReactiveObjC/RACSignal+Operations.h +++ b/ReactiveObjC/RACSignal+Operations.h @@ -7,7 +7,7 @@ // #import -#import "RACSignal.h" +#import @class RACCommand; @class RACDisposable; diff --git a/ReactiveObjC/RACSignal+Operations.m b/ReactiveObjC/RACSignal+Operations.m index 7cb0c16a8..2eb79b25c 100644 --- a/ReactiveObjC/RACSignal+Operations.m +++ b/ReactiveObjC/RACSignal+Operations.m @@ -26,7 +26,7 @@ #import "RACSubscriber.h" #import "RACTuple.h" #import "RACUnit.h" -#import +#import #import #import @@ -700,7 +700,7 @@ - (RACDisposable *)setKeyPath:(NSString *)keyPath onObject:(NSObject *)object ni // Purposely not retaining 'object', since we want to tear down the binding // when it deallocates normally. - __block void * volatile objectPtr = (__bridge void *)object; + __block _Atomic(void *) objectPtr = (__bridge void *)object; RACDisposable *subscriptionDisposable = [self subscribeNext:^(id x) { // Possibly spec, possibly compiler bug, but this __bridge cast does not @@ -752,7 +752,7 @@ - (RACDisposable *)setKeyPath:(NSString *)keyPath onObject:(NSObject *)object ni while (YES) { void *ptr = objectPtr; - if (OSAtomicCompareAndSwapPtrBarrier(ptr, NULL, &objectPtr)) { + if (atomic_compare_exchange_strong(&objectPtr, &ptr, NULL)) { break; } } @@ -1151,17 +1151,17 @@ - (RACSignal *)subscribeOn:(RACScheduler *)scheduler { - (RACSignal *)deliverOnMainThread { return [[RACSignal createSignal:^(id subscriber) { - __block volatile int32_t queueLength = 0; - + __block atomic_int queueLength = 0; + void (^performOnMainThread)(dispatch_block_t) = ^(dispatch_block_t block) { - int32_t queued = OSAtomicIncrement32(&queueLength); + int32_t queued = atomic_fetch_add(&queueLength, 1) + 1; if (NSThread.isMainThread && queued == 1) { block(); - OSAtomicDecrement32(&queueLength); + atomic_fetch_sub(&queueLength, 1); } else { dispatch_async(dispatch_get_main_queue(), ^{ block(); - OSAtomicDecrement32(&queueLength); + atomic_fetch_sub(&queueLength, 1); }); } }; diff --git a/ReactiveObjC/RACSignal.h b/ReactiveObjC/RACSignal.h index fd417c521..92ee98058 100644 --- a/ReactiveObjC/RACSignal.h +++ b/ReactiveObjC/RACSignal.h @@ -7,8 +7,8 @@ // #import -#import "RACAnnotations.h" -#import "RACStream.h" +#import +#import @class RACDisposable; @class RACScheduler; diff --git a/ReactiveObjC/RACSignal.m b/ReactiveObjC/RACSignal.m index 8aa9464fc..5d007f426 100644 --- a/ReactiveObjC/RACSignal.m +++ b/ReactiveObjC/RACSignal.m @@ -23,7 +23,7 @@ #import "RACSubject.h" #import "RACSubscriber+Private.h" #import "RACTuple.h" -#import +#import @implementation RACSignal @@ -108,12 +108,12 @@ - (RACSignal *)bind:(RACSignalBindBlock (^)(void))block { return [[RACSignal createSignal:^(id subscriber) { RACSignalBindBlock bindingBlock = block(); - __block volatile int32_t signalCount = 1; // indicates self + __block atomic_int signalCount = 1; // indicates self RACCompoundDisposable *compoundDisposable = [RACCompoundDisposable compoundDisposable]; void (^completeSignal)(RACDisposable *) = ^(RACDisposable *finishedDisposable) { - if (OSAtomicDecrement32Barrier(&signalCount) == 0) { + if (atomic_fetch_sub(&signalCount, 1) - 1 == 0) { [subscriber sendCompleted]; [compoundDisposable dispose]; } else { @@ -122,7 +122,7 @@ - (RACSignal *)bind:(RACSignalBindBlock (^)(void))block { }; void (^addSignal)(RACSignal *) = ^(RACSignal *signal) { - OSAtomicIncrement32Barrier(&signalCount); + atomic_fetch_add(&signalCount, 1); RACSerialDisposable *selfDisposable = [[RACSerialDisposable alloc] init]; [compoundDisposable addDisposable:selfDisposable]; @@ -363,7 +363,7 @@ - (instancetype)filter:(BOOL (^)(id))block { - (instancetype)flattenMap:(RACSignal *(^)(id))block { return [RACSignal createSignal:^RACDisposable *(id subscriber) { - __block volatile int32_t subscriptionCount = 1; + __block atomic_int subscriptionCount = 1; RACCompoundDisposable *disposable = [RACCompoundDisposable compoundDisposable]; @@ -378,7 +378,7 @@ - (instancetype)flattenMap:(RACSignal *(^)(id))block { } NSCAssert([signal isKindOfClass:RACSignal.class], @"Expected a RACSignal, got %@", signal); - OSAtomicIncrement32(&subscriptionCount); + atomic_fetch_add(&subscriptionCount, 1); RACDisposable *innerDisposable = [signal subscribeNext:^(id x) { [subscriber sendNext:x]; @@ -386,7 +386,7 @@ - (instancetype)flattenMap:(RACSignal *(^)(id))block { [subscriber sendError:error]; [disposable dispose]; } completed:^{ - if (!OSAtomicDecrement32(&subscriptionCount)) { + if (atomic_fetch_sub(&subscriptionCount, 1) - 1 == 0) { [subscriber sendCompleted]; } }]; @@ -395,7 +395,7 @@ - (instancetype)flattenMap:(RACSignal *(^)(id))block { } error:^(NSError *error) { [subscriber sendError:error]; } completed:^{ - if (!OSAtomicDecrement32(&subscriptionCount)) { + if (atomic_fetch_sub(&subscriptionCount, 1) - 1 == 0) { [subscriber sendCompleted]; } }]; diff --git a/ReactiveObjC/RACSubject.h b/ReactiveObjC/RACSubject.h index 79807d96d..01b3c8c8d 100644 --- a/ReactiveObjC/RACSubject.h +++ b/ReactiveObjC/RACSubject.h @@ -6,8 +6,8 @@ // Copyright (c) 2012 GitHub, Inc. All rights reserved. // -#import "RACSignal.h" -#import "RACSubscriber.h" +#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACTargetQueueScheduler.h b/ReactiveObjC/RACTargetQueueScheduler.h index 01618115c..e9a7f3a33 100644 --- a/ReactiveObjC/RACTargetQueueScheduler.h +++ b/ReactiveObjC/RACTargetQueueScheduler.h @@ -6,7 +6,7 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import "RACQueueScheduler.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACTestScheduler.h b/ReactiveObjC/RACTestScheduler.h index bf460e0c9..78f1e02e4 100644 --- a/ReactiveObjC/RACTestScheduler.h +++ b/ReactiveObjC/RACTestScheduler.h @@ -6,7 +6,7 @@ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // -#import "RACScheduler.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactiveObjC/RACTuple.h b/ReactiveObjC/RACTuple.h index 291ff7f23..9af7d8227 100644 --- a/ReactiveObjC/RACTuple.h +++ b/ReactiveObjC/RACTuple.h @@ -7,7 +7,7 @@ // #import -#import "metamacros.h" +#import @class RACSequence; diff --git a/ReactiveObjC/ReactiveObjC.h b/ReactiveObjC/ReactiveObjC.h index 251515db4..f7763617d 100644 --- a/ReactiveObjC/ReactiveObjC.h +++ b/ReactiveObjC/ReactiveObjC.h @@ -78,8 +78,6 @@ FOUNDATION_EXPORT const unsigned char ReactiveObjCVersionString[]; #import #import #import - #import - #import #import #import #import diff --git a/ReactiveObjC/UIActionSheet+RACSignalSupport.h b/ReactiveObjC/UIActionSheet+RACSignalSupport.h deleted file mode 100644 index 8308bbd54..000000000 --- a/ReactiveObjC/UIActionSheet+RACSignalSupport.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// UIActionSheet+RACSignalSupport.h -// ReactiveObjC -// -// Created by Dave Lee on 2013-06-22. -// Copyright (c) 2013 GitHub, Inc. All rights reserved. -// - -#import - -@class RACDelegateProxy; -@class RACSignal<__covariant ValueType>; - -NS_ASSUME_NONNULL_BEGIN - -@interface UIActionSheet (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 button clicks on the receiver. -/// -/// 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 index of the specific button clicked. -/// The signal will complete when the receiver is deallocated. -- (RACSignal *)rac_buttonClickedSignal; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ReactiveObjC/UIActionSheet+RACSignalSupport.m b/ReactiveObjC/UIActionSheet+RACSignalSupport.m deleted file mode 100644 index 5839699e3..000000000 --- a/ReactiveObjC/UIActionSheet+RACSignalSupport.m +++ /dev/null @@ -1,49 +0,0 @@ -// -// UIActionSheet+RACSignalSupport.m -// ReactiveObjC -// -// Created by Dave Lee on 2013-06-22. -// Copyright (c) 2013 GitHub, Inc. All rights reserved. -// - -#import "UIActionSheet+RACSignalSupport.h" -#import "RACDelegateProxy.h" -#import "RACSignal+Operations.h" -#import "NSObject+RACDeallocating.h" -#import "NSObject+RACDescription.h" -#import - -@implementation UIActionSheet (RACSignalSupport) - -static void RACUseDelegateProxy(UIActionSheet *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(UIActionSheetDelegate)]; - objc_setAssociatedObject(self, _cmd, proxy, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } - - return proxy; -} - -- (RACSignal *)rac_buttonClickedSignal { - RACSignal *signal = [[[[self.rac_delegateProxy - signalForSelector:@selector(actionSheet:clickedButtonAtIndex:)] - reduceEach:^(UIActionSheet *actionSheet, NSNumber *buttonIndex) { - return buttonIndex; - }] - takeUntil:self.rac_willDeallocSignal] - setNameWithFormat:@"%@ -rac_buttonClickedSignal", RACDescription(self)]; - - RACUseDelegateProxy(self); - - return signal; -} - -@end diff --git a/ReactiveObjC/UIAlertView+RACSignalSupport.h b/ReactiveObjC/UIAlertView+RACSignalSupport.h deleted file mode 100644 index 7508c2e4b..000000000 --- a/ReactiveObjC/UIAlertView+RACSignalSupport.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// UIAlertView+RACSignalSupport.h -// ReactiveObjC -// -// Created by Henrik Hodne on 6/16/13. -// Copyright (c) 2013 GitHub, Inc. All rights reserved. -// - -#import - -@class RACDelegateProxy; -@class RACSignal<__covariant ValueType>; - -NS_ASSUME_NONNULL_BEGIN - -@interface UIAlertView (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 button clicks on the receiver. -/// -/// 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. -/// -/// Note that this signal will not send a value when the alert is dismissed -/// programatically. -/// -/// Returns a signal which will send the index of the specific button clicked. -/// The signal will complete itself when the receiver is deallocated. -- (RACSignal *)rac_buttonClickedSignal; - -/// Creates a signal for dismissal of the receiver. -/// -/// 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 index of the button associated with the -/// dismissal. The signal will complete itself when the receiver is deallocated. -- (RACSignal *)rac_willDismissSignal; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ReactiveObjC/UIAlertView+RACSignalSupport.m b/ReactiveObjC/UIAlertView+RACSignalSupport.m deleted file mode 100644 index 38741fd41..000000000 --- a/ReactiveObjC/UIAlertView+RACSignalSupport.m +++ /dev/null @@ -1,63 +0,0 @@ -// -// UIAlertView+RACSignalSupport.m -// ReactiveObjC -// -// Created by Henrik Hodne on 6/16/13. -// Copyright (c) 2013 GitHub, Inc. All rights reserved. -// - -#import "UIAlertView+RACSignalSupport.h" -#import "RACDelegateProxy.h" -#import "RACSignal+Operations.h" -#import "NSObject+RACDeallocating.h" -#import "NSObject+RACDescription.h" -#import - -@implementation UIAlertView (RACSignalSupport) - -static void RACUseDelegateProxy(UIAlertView *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(UIAlertViewDelegate)]; - objc_setAssociatedObject(self, _cmd, proxy, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } - - return proxy; -} - -- (RACSignal *)rac_buttonClickedSignal { - RACSignal *signal = [[[[self.rac_delegateProxy - signalForSelector:@selector(alertView:clickedButtonAtIndex:)] - reduceEach:^(UIAlertView *alertView, NSNumber *buttonIndex) { - return buttonIndex; - }] - takeUntil:self.rac_willDeallocSignal] - setNameWithFormat:@"%@ -rac_buttonClickedSignal", RACDescription(self)]; - - RACUseDelegateProxy(self); - - return signal; -} - -- (RACSignal *)rac_willDismissSignal { - RACSignal *signal = [[[[self.rac_delegateProxy - signalForSelector:@selector(alertView:willDismissWithButtonIndex:)] - reduceEach:^(UIAlertView *alertView, NSNumber *buttonIndex) { - return buttonIndex; - }] - takeUntil:self.rac_willDeallocSignal] - setNameWithFormat:@"%@ -rac_willDismissSignal", RACDescription(self)]; - - RACUseDelegateProxy(self); - - return signal; -} - -@end diff --git a/ReactiveObjC/extobjc/EXTKeyPathCoding.h b/ReactiveObjC/extobjc/EXTKeyPathCoding.h index 78a47dcfa..60d3a872e 100644 --- a/ReactiveObjC/extobjc/EXTKeyPathCoding.h +++ b/ReactiveObjC/extobjc/EXTKeyPathCoding.h @@ -8,7 +8,7 @@ // #import -#import "metamacros.h" +#import /** * \@rac_keypath allows compile-time verification of key paths. Given a real object diff --git a/ReactiveObjC/extobjc/EXTRuntimeExtensions.m b/ReactiveObjC/extobjc/EXTRuntimeExtensions.m index 6a6e6f222..f6dee040d 100644 --- a/ReactiveObjC/extobjc/EXTRuntimeExtensions.m +++ b/ReactiveObjC/extobjc/EXTRuntimeExtensions.m @@ -11,7 +11,6 @@ #import #import -#import #import #import #import diff --git a/ReactiveObjC/extobjc/EXTScope.h b/ReactiveObjC/extobjc/EXTScope.h index 6dcac5bdd..851f987a1 100644 --- a/ReactiveObjC/extobjc/EXTScope.h +++ b/ReactiveObjC/extobjc/EXTScope.h @@ -7,7 +7,7 @@ // Released under the MIT license. // -#import "metamacros.h" +#import /** * \@rac_onExit defines some code to be executed when the current scope exits. The diff --git a/ReactiveObjCTests/RACMulticastConnectionSpec.m b/ReactiveObjCTests/RACMulticastConnectionSpec.m index 78769157f..3229f69c8 100644 --- a/ReactiveObjCTests/RACMulticastConnectionSpec.m +++ b/ReactiveObjCTests/RACMulticastConnectionSpec.m @@ -15,7 +15,6 @@ #import "RACSubscriber.h" #import "RACReplaySubject.h" #import "RACScheduler.h" -#import QuickSpecBegin(RACMulticastConnectionSpec) diff --git a/ReactiveObjCTests/RACSequenceExamples.m b/ReactiveObjCTests/RACSequenceExamples.m index 50b13f0b6..9d3773249 100644 --- a/ReactiveObjCTests/RACSequenceExamples.m +++ b/ReactiveObjCTests/RACSequenceExamples.m @@ -107,10 +107,15 @@ + (void)configure:(Configuration *)configuration { }); qck_it(@"should archive", ^{ - NSData *data = [NSKeyedArchiver archivedDataWithRootObject:sequence]; + NSError *error; + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:sequence requiringSecureCoding:NO error:&error]; expect(data).notTo(beNil()); - RACSequence *unarchived = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:data error:&error]; + expect(error).to(beNil()); + + unarchiver.requiresSecureCoding = NO; + RACSequence *unarchived = [unarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey]; expect(unarchived).to(equal(sequence)); }); diff --git a/ReactiveObjCTests/RACSignalSpec.m b/ReactiveObjCTests/RACSignalSpec.m index 6062cba06..ce65db98a 100644 --- a/ReactiveObjCTests/RACSignalSpec.m +++ b/ReactiveObjCTests/RACSignalSpec.m @@ -121,7 +121,7 @@ + (void)configure:(Configuration *)configuration { }]; return [RACDisposable disposableWithBlock:^{ - ++done; + atomic_fetch_add(&done, 1); }]; }]; diff --git a/ReactiveObjCTests/RACSubscriberSpec.m b/ReactiveObjCTests/RACSubscriberSpec.m index 5ba5da3f9..585086c3e 100644 --- a/ReactiveObjCTests/RACSubscriberSpec.m +++ b/ReactiveObjCTests/RACSubscriberSpec.m @@ -13,15 +13,15 @@ #import "RACSubscriber.h" #import "RACSubscriber+Private.h" -#import +#import QuickSpecBegin(RACSubscriberSpec) __block RACSubscriber *subscriber; __block NSMutableArray *values; -__block volatile BOOL finished; -__block volatile int32_t nextsAfterFinished; +__block _Atomic(BOOL) finished; +__block atomic_int nextsAfterFinished; __block BOOL success; __block NSError *error; @@ -36,7 +36,7 @@ error = nil; subscriber = [RACSubscriber subscriberWithNext:^(id value) { - if (finished) OSAtomicIncrement32Barrier(&nextsAfterFinished); + if (finished) atomic_fetch_add(&nextsAfterFinished, 1); [values addObject:value]; } error:^(NSError *e) { @@ -111,7 +111,7 @@ [subscriber sendCompleted]; finished = YES; - OSMemoryBarrier(); + atomic_thread_fence(memory_order_seq_cst); }); }); @@ -122,7 +122,7 @@ [subscriber sendError:nil]; finished = YES; - OSMemoryBarrier(); + atomic_thread_fence(memory_order_seq_cst); }); }); }); diff --git a/ReactiveObjCTests/RACTargetQueueSchedulerSpec.m b/ReactiveObjCTests/RACTargetQueueSchedulerSpec.m index 0dca0a3a0..70f28463c 100644 --- a/ReactiveObjCTests/RACTargetQueueSchedulerSpec.m +++ b/ReactiveObjCTests/RACTargetQueueSchedulerSpec.m @@ -10,7 +10,7 @@ @import Nimble; #import "RACTargetQueueScheduler.h" -#import +#import QuickSpecBegin(RACTargetQueueSchedulerSpec) @@ -28,20 +28,20 @@ qck_it(@"should schedule blocks FIFO even when given a concurrent queue", ^{ dispatch_queue_t queue = dispatch_queue_create("test-queue", DISPATCH_QUEUE_CONCURRENT); RACScheduler *scheduler = [[RACTargetQueueScheduler alloc] initWithName:@"test-scheduler" targetQueue:queue]; - __block volatile int32_t startedCount = 0; - __block volatile uint32_t waitInFirst = 1; + __block atomic_int startedCount = 0; + __block atomic_uint waitInFirst = 1; [scheduler schedule:^{ - OSAtomicIncrement32Barrier(&startedCount); + atomic_fetch_add(&startedCount, 1); while (waitInFirst == 1) ; }]; [scheduler schedule:^{ - OSAtomicIncrement32Barrier(&startedCount); + atomic_fetch_add(&startedCount, 1); }]; expect(@(startedCount)).toEventually(equal(@1)); - OSAtomicAnd32Barrier(0, &waitInFirst); + atomic_fetch_and(&waitInFirst, 0); expect(@(startedCount)).toEventually(equal(@2)); }); diff --git a/ReactiveObjCTests/UIActionSheetRACSupportSpec.m b/ReactiveObjCTests/UIActionSheetRACSupportSpec.m deleted file mode 100644 index 709e59c5d..000000000 --- a/ReactiveObjCTests/UIActionSheetRACSupportSpec.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// UIActionSheetRACSupportSpec.m -// ReactiveObjC -// -// Created by Dave Lee on 2013-06-22. -// Copyright (c) 2013 GitHub, Inc. All rights reserved. -// - -@import Quick; -@import Nimble; - -#import "RACSignal.h" -#import "RACSignal+Operations.h" -#import "UIActionSheet+RACSignalSupport.h" - -QuickSpecBegin(UIActionSheetRACSupportSpec) - -qck_describe(@"-rac_buttonClickedSignal", ^{ - __block UIActionSheet *actionSheet; - - qck_beforeEach(^{ - actionSheet = [[UIActionSheet alloc] init]; - [actionSheet addButtonWithTitle:@"Button 0"]; - [actionSheet addButtonWithTitle:@"Button 1"]; - expect(actionSheet).notTo(beNil()); - }); - - qck_it(@"should send the index of the clicked button", ^{ - __block NSNumber *index = nil; - [actionSheet.rac_buttonClickedSignal subscribeNext:^(NSNumber *i) { - index = i; - }]; - - [actionSheet.delegate actionSheet:actionSheet clickedButtonAtIndex:1]; - expect(index).to(equal(@1)); - }); -}); - -QuickSpecEnd diff --git a/ReactiveObjCTests/UIAlertViewRACSupportSpec.m b/ReactiveObjCTests/UIAlertViewRACSupportSpec.m deleted file mode 100644 index 9f5abe49e..000000000 --- a/ReactiveObjCTests/UIAlertViewRACSupportSpec.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// UIAlertViewRACSupportSpec.m -// ReactiveObjC -// -// Created by Henrik Hodne on 6/16/13. -// Copyright (c) 2013 GitHub, Inc. All rights reserved. -// - -@import Quick; -@import Nimble; - -#import -#import "RACSignal.h" -#import "UIAlertView+RACSignalSupport.h" - -QuickSpecBegin(UIAlertViewRACSupportSpec) - -qck_describe(@"UIAlertView", ^{ - __block UIAlertView *alertView; - - qck_beforeEach(^{ - alertView = [[UIAlertView alloc] initWithFrame:CGRectZero]; - expect(alertView).notTo(beNil()); - }); - - qck_it(@"sends the index of the clicked button to the buttonClickedSignal when a button is clicked", ^{ - __block NSInteger index = -1; - [alertView.rac_buttonClickedSignal subscribeNext:^(NSNumber *sentIndex) { - index = sentIndex.integerValue; - }]; - - [alertView.delegate alertView:alertView clickedButtonAtIndex:2]; - expect(@(index)).to(equal(@2)); - }); - - qck_it(@"sends the index of the appropriate button to the willDismissSignal when dismissed programatically", ^{ - __block NSInteger index = -1; - [alertView.rac_willDismissSignal subscribeNext:^(NSNumber *sentIndex) { - index = sentIndex.integerValue; - }]; - - [alertView.delegate alertView:alertView willDismissWithButtonIndex:2]; - expect(@(index)).to(equal(@2)); - }); -}); - -QuickSpecEnd