diff --git a/.travis.yml b/.travis.yml index fc992dd89..67e2f236b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,16 @@ +os: osx language: objective-c -osx_image: xcode10.2 +osx_image: xcode11.6 before_install: true install: true branches: only: - master + - main script: - script/build xcode_workspace: ReactiveObjC.xcworkspace -matrix: +jobs: include: - xcode_scheme: ReactiveObjC-macOS env: @@ -19,7 +21,7 @@ matrix: env: - XCODE_SDK=iphonesimulator - XCODE_ACTION="build-for-testing test-without-building" - - XCODE_DESTINATION="platform=iOS Simulator,name=iPhone 6s" + - XCODE_DESTINATION="platform=iOS Simulator,name=iPhone 11" - xcode_scheme: ReactiveObjC-tvOS env: - XCODE_SDK=appletvsimulator diff --git a/Cartfile.resolved b/Cartfile.resolved index 5d9c1cae2..6deb24ccb 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ -github "Quick/Nimble" "v8.0.1" -github "Quick/Quick" "v2.0.0" +github "Quick/Nimble" "v8.1.1" +github "Quick/Quick" "v2.2.1" github "jspahrsummers/xcconfigs" "3d9d99634cae6d586e272543d527681283b33eb0" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 43304bf2b..2b1809051 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 43304bf2b1579fd555f2fdd51742771c1e4f2b98 +Subproject commit 2b1809051b4a65c1d7f5233331daa24572cd7fca diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index 0b4ed6c70..09b3becb3 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit 0b4ed6c706dd0cce923b5019a605a9bcc6b1b600 +Subproject commit 09b3becb37cb2163919a3842a4c5fa6ec7130792 diff --git a/README.md b/README.md index ab43c42af..cf6ee8428 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # ReactiveObjC +[![Build Status](https://travis-ci.org/ReactiveCocoa/ReactiveObjC.svg?branch=master)](https://travis-ci.org/ReactiveCocoa/ReactiveObjC) _NOTE: This is legacy introduction to the Objective-C ReactiveCocoa, which is now known as ReactiveObjC. For the updated version that uses Swift, please see diff --git a/ReactiveObjC.xcodeproj/project.pbxproj b/ReactiveObjC.xcodeproj/project.pbxproj index 31b7adf66..436cf834b 100644 --- a/ReactiveObjC.xcodeproj/project.pbxproj +++ b/ReactiveObjC.xcodeproj/project.pbxproj @@ -1951,7 +1951,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 1160; ORGANIZATIONNAME = GitHub; TargetAttributes = { 57A4D1AF1BA13D7A00F7D4B1 = { @@ -1975,11 +1975,11 @@ }; D047260B19E49F82006002AA = { CreatedOnToolsVersion = 6.1; - LastSwiftMigration = 1010; + LastSwiftMigration = 1160; }; D047261519E49F82006002AA = { CreatedOnToolsVersion = 6.1; - LastSwiftMigration = 1010; + LastSwiftMigration = 1160; }; }; }; @@ -2601,8 +2601,7 @@ "DTRACE_PROBES_DISABLED=1", ); INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; }; name = Debug; }; @@ -2621,8 +2620,7 @@ "DTRACE_PROBES_DISABLED=1", ); INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; }; name = Test; }; @@ -2641,8 +2639,7 @@ "DTRACE_PROBES_DISABLED=1", ); INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; }; name = Release; }; @@ -2661,7 +2658,7 @@ "DTRACE_PROBES_DISABLED=1", ); INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; }; name = Profile; }; @@ -2677,9 +2674,8 @@ "$(inherited)", ); INFOPLIST_FILE = ReactiveObjCTests/Info.plist; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -2695,9 +2691,8 @@ "$(inherited)", ); INFOPLIST_FILE = ReactiveObjCTests/Info.plist; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; }; name = Test; }; @@ -2713,9 +2708,8 @@ "$(inherited)", ); INFOPLIST_FILE = ReactiveObjCTests/Info.plist; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; }; name = Release; }; @@ -2731,8 +2725,8 @@ "$(inherited)", ); INFOPLIST_FILE = ReactiveObjCTests/Info.plist; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_VERSION = 4.2; }; name = Profile; }; @@ -2751,8 +2745,7 @@ "DTRACE_PROBES_DISABLED=1", ); INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; }; name = Debug; }; @@ -2771,8 +2764,7 @@ "DTRACE_PROBES_DISABLED=1", ); INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; }; name = Test; }; @@ -2791,8 +2783,7 @@ "DTRACE_PROBES_DISABLED=1", ); INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; }; name = Release; }; @@ -2811,7 +2802,7 @@ "DTRACE_PROBES_DISABLED=1", ); INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; }; name = Profile; }; @@ -2820,13 +2811,25 @@ baseConfigurationReference = D047262919E49FE8006002AA /* Debug.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = bitcode; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGNING_REQUIRED = NO; + COMPILER_INDEX_STORE_ENABLE = YES; CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_TESTABILITY = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + GCC_C_LANGUAGE_STANDARD = gnu11; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "org.reactivecocoa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(PROJECT_NAME)"; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -2843,13 +2846,25 @@ baseConfigurationReference = D047262B19E49FE8006002AA /* Release.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = bitcode; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGNING_REQUIRED = NO; + COMPILER_INDEX_STORE_ENABLE = YES; CURRENT_PROJECT_VERSION = 1; - GCC_OPTIMIZATION_LEVEL = 0; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_C_LANGUAGE_STANDARD = gnu11; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "org.reactivecocoa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(PROJECT_NAME)"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -2872,8 +2887,7 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; USER_HEADER_SEARCH_PATHS = ReactiveObjC/extobjc; }; name = Debug; @@ -2889,8 +2903,7 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; USER_HEADER_SEARCH_PATHS = ReactiveObjC/extobjc; }; name = Release; @@ -2906,10 +2919,8 @@ "$(inherited)", ); INFOPLIST_FILE = ReactiveObjCTests/Info.plist; - MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -2924,10 +2935,8 @@ "$(inherited)", ); INFOPLIST_FILE = ReactiveObjCTests/Info.plist; - MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; }; name = Release; }; @@ -2940,10 +2949,8 @@ DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; - ENABLE_BITCODE = YES; INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; USER_HEADER_SEARCH_PATHS = ReactiveObjC/extobjc; }; name = Debug; @@ -2957,10 +2964,8 @@ DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; - ENABLE_BITCODE = YES; INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; USER_HEADER_SEARCH_PATHS = ReactiveObjC/extobjc; }; name = Release; @@ -2972,9 +2977,8 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = ReactiveObjCTests/Info.plist; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -2985,9 +2989,8 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = ReactiveObjCTests/Info.plist; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; }; name = Release; }; @@ -2996,12 +2999,24 @@ baseConfigurationReference = D047262A19E49FE8006002AA /* Profile.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = bitcode; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGNING_REQUIRED = NO; + COMPILER_INDEX_STORE_ENABLE = YES; CURRENT_PROJECT_VERSION = 1; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.9; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_C_LANGUAGE_STANDARD = gnu11; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "org.reactivecocoa.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(PROJECT_NAME)"; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -3024,7 +3039,7 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; USER_HEADER_SEARCH_PATHS = ReactiveObjC/extobjc; }; name = Profile; @@ -3040,9 +3055,8 @@ "$(inherited)", ); INFOPLIST_FILE = ReactiveObjCTests/Info.plist; - MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_VERSION = 4.2; }; name = Profile; }; @@ -3055,9 +3069,8 @@ DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; - ENABLE_BITCODE = YES; INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; USER_HEADER_SEARCH_PATHS = ReactiveObjC/extobjc; }; name = Profile; @@ -3069,8 +3082,8 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = ReactiveObjCTests/Info.plist; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_VERSION = 4.2; }; name = Profile; }; @@ -3079,12 +3092,25 @@ baseConfigurationReference = D047262C19E49FE8006002AA /* Test.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = bitcode; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGNING_REQUIRED = NO; + COMPILER_INDEX_STORE_ENABLE = YES; CURRENT_PROJECT_VERSION = 1; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "org.reactivecocoa.$(PRODUCT_NAME:rfc1034identifier)-Tests"; PRODUCT_NAME = "$(PROJECT_NAME)"; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -3107,8 +3133,7 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; USER_HEADER_SEARCH_PATHS = ReactiveObjC/extobjc; }; name = Test; @@ -3124,10 +3149,8 @@ "$(inherited)", ); INFOPLIST_FILE = ReactiveObjCTests/Info.plist; - MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; }; name = Test; }; @@ -3140,10 +3163,8 @@ DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; - ENABLE_BITCODE = YES; INFOPLIST_FILE = ReactiveObjC/Info.plist; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + MACH_O_TYPE = staticlib; USER_HEADER_SEARCH_PATHS = ReactiveObjC/extobjc; }; name = Test; @@ -3155,9 +3176,8 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = ReactiveObjCTests/Info.plist; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(PROJECT_NAME)Tests"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; }; name = Test; }; diff --git a/ReactiveObjC.xcodeproj/xcshareddata/xcschemes/ReactiveObjC-iOS.xcscheme b/ReactiveObjC.xcodeproj/xcshareddata/xcschemes/ReactiveObjC-iOS.xcscheme index 52e154e94..2c58e8806 100644 --- a/ReactiveObjC.xcodeproj/xcshareddata/xcschemes/ReactiveObjC-iOS.xcscheme +++ b/ReactiveObjC.xcodeproj/xcshareddata/xcschemes/ReactiveObjC-iOS.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -82,17 +91,6 @@ - - - - - - - - + + + + @@ -82,17 +91,6 @@ - - - - - - - - + + + + @@ -82,17 +91,6 @@ - - - - - - - - - - - - + + - - @implementation NSObject (RACPropertySubscribing) diff --git a/ReactiveObjC/NSURLConnection+RACSupport.h b/ReactiveObjC/NSURLConnection+RACSupport.h index c1c5731d7..fd81492d3 100644 --- a/ReactiveObjC/NSURLConnection+RACSupport.h +++ b/ReactiveObjC/NSURLConnection+RACSupport.h @@ -5,6 +5,7 @@ // Created by Justin Spahr-Summers on 2013-10-01. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // +#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11 || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 || __TVOS_VERSION_MIN_REQUIRED < __TVOS_9_0 #import @@ -28,3 +29,5 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END + +#endif diff --git a/ReactiveObjC/NSURLConnection+RACSupport.m b/ReactiveObjC/NSURLConnection+RACSupport.m index 7acd322ae..dd6c025b6 100644 --- a/ReactiveObjC/NSURLConnection+RACSupport.m +++ b/ReactiveObjC/NSURLConnection+RACSupport.m @@ -5,6 +5,7 @@ // Created by Justin Spahr-Summers on 2013-10-01. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // +#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11 || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 || __TVOS_VERSION_MIN_REQUIRED < __TVOS_9_0 #import "NSURLConnection+RACSupport.h" #import "RACDisposable.h" @@ -52,3 +53,5 @@ + (RACSignal *)rac_sendAsynchronousRequest:(NSURLRequest *)request { } @end + +#endif diff --git a/ReactiveObjC/RACCommand.m b/ReactiveObjC/RACCommand.m index 4342f80ba..db4c6ba98 100644 --- a/ReactiveObjC/RACCommand.m +++ b/ReactiveObjC/RACCommand.m @@ -17,14 +17,14 @@ #import "RACScheduler.h" #import "RACSequence.h" #import "RACSignal+Operations.h" -#import +#import NSErrorDomain const RACCommandErrorDomain = @"RACCommandErrorDomain"; NSString * const RACUnderlyingCommandErrorKey = @"RACUnderlyingCommandErrorKey"; @interface RACCommand () { // Atomic backing variable for `allowsConcurrentExecution`. - volatile uint32_t _allowsConcurrentExecution; + atomic_uint _allowsConcurrentExecution; } /// A subject that sends added execution signals. @@ -53,9 +53,9 @@ - (BOOL)allowsConcurrentExecution { - (void)setAllowsConcurrentExecution:(BOOL)allowed { if (allowed) { - OSAtomicOr32Barrier(1, &_allowsConcurrentExecution); + atomic_fetch_or(&_allowsConcurrentExecution, 1); } else { - OSAtomicAnd32Barrier(0, &_allowsConcurrentExecution); + atomic_fetch_and(&_allowsConcurrentExecution, 0); } [self.allowsConcurrentExecutionSubject sendNext:@(_allowsConcurrentExecution)]; diff --git a/ReactiveObjC/RACDisposable.m b/ReactiveObjC/RACDisposable.m index 3cba07f4f..55e92964e 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; } @@ -46,7 +46,7 @@ - (instancetype)initWithBlock:(void (^)(void))block { self = [super init]; _disposeBlock = (void *)CFBridgingRetain([block copy]); - OSMemoryBarrier(); + 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 177a22514..863a48f1f 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 3bee2f7c2..53d6d2e9e 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/RACMulticastConnection.m b/ReactiveObjC/RACMulticastConnection.m index f59824500..3b6183535 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/RACSignal+Operations.m b/ReactiveObjC/RACSignal+Operations.m index 87967adfd..15c10de5e 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 NSErrorDomain const RACSignalErrorDomain = @"RACSignalErrorDomain"; @@ -646,7 +646,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 @@ -698,7 +698,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; } } @@ -1048,17 +1048,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.m b/ReactiveObjC/RACSignal.m index 84607f681..eb79e6039 100644 --- a/ReactiveObjC/RACSignal.m +++ b/ReactiveObjC/RACSignal.m @@ -21,7 +21,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]; diff --git a/ReactiveObjC/UIActionSheet+RACSignalSupport.h b/ReactiveObjC/UIActionSheet+RACSignalSupport.h index 8308bbd54..717326977 100644 --- a/ReactiveObjC/UIActionSheet+RACSignalSupport.h +++ b/ReactiveObjC/UIActionSheet+RACSignalSupport.h @@ -5,6 +5,7 @@ // Created by Dave Lee on 2013-06-22. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 #import @@ -34,3 +35,5 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END + +#endif diff --git a/ReactiveObjC/UIActionSheet+RACSignalSupport.m b/ReactiveObjC/UIActionSheet+RACSignalSupport.m index 6a1a4102d..7f95ecd6e 100644 --- a/ReactiveObjC/UIActionSheet+RACSignalSupport.m +++ b/ReactiveObjC/UIActionSheet+RACSignalSupport.m @@ -5,6 +5,7 @@ // Created by Dave Lee on 2013-06-22. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 #import "UIActionSheet+RACSignalSupport.h" #import "RACDelegateProxy.h" @@ -47,3 +48,5 @@ - (RACSignal *)rac_buttonClickedSignal { } @end + +#endif diff --git a/ReactiveObjC/UIAlertView+RACSignalSupport.h b/ReactiveObjC/UIAlertView+RACSignalSupport.h index 7508c2e4b..e6a41f89a 100644 --- a/ReactiveObjC/UIAlertView+RACSignalSupport.h +++ b/ReactiveObjC/UIAlertView+RACSignalSupport.h @@ -5,6 +5,7 @@ // Created by Henrik Hodne on 6/16/13. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 #import @@ -49,3 +50,5 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END + +#endif diff --git a/ReactiveObjC/UIAlertView+RACSignalSupport.m b/ReactiveObjC/UIAlertView+RACSignalSupport.m index 0afc94a8d..4f540b3d2 100644 --- a/ReactiveObjC/UIAlertView+RACSignalSupport.m +++ b/ReactiveObjC/UIAlertView+RACSignalSupport.m @@ -5,6 +5,7 @@ // Created by Henrik Hodne on 6/16/13. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 #import "UIAlertView+RACSignalSupport.h" #import "RACDelegateProxy.h" @@ -61,3 +62,5 @@ - (RACSignal *)rac_willDismissSignal { } @end + +#endif diff --git a/ReactiveObjC/extobjc/EXTRuntimeExtensions.m b/ReactiveObjC/extobjc/EXTRuntimeExtensions.m index 99c10e980..3a2dca635 100644 --- a/ReactiveObjC/extobjc/EXTRuntimeExtensions.m +++ b/ReactiveObjC/extobjc/EXTRuntimeExtensions.m @@ -11,7 +11,6 @@ #import #import -#import #import #import #import diff --git a/ReactiveObjCTests/NSURLConnectionRACSupportSpec.m b/ReactiveObjCTests/NSURLConnectionRACSupportSpec.m index 84de95c92..ccd292d2d 100644 --- a/ReactiveObjCTests/NSURLConnectionRACSupportSpec.m +++ b/ReactiveObjCTests/NSURLConnectionRACSupportSpec.m @@ -5,6 +5,7 @@ // Created by Justin Spahr-Summers on 2013-10-01. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // +#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11 || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 || __TVOS_VERSION_MIN_REQUIRED < __TVOS_9_0 @import Quick; @import Nimble; @@ -37,3 +38,5 @@ }); QuickSpecEnd + +#endif diff --git a/ReactiveObjCTests/RACKVOWrapperSpec.m b/ReactiveObjCTests/RACKVOWrapperSpec.m index 71197d672..705d983fd 100644 --- a/ReactiveObjCTests/RACKVOWrapperSpec.m +++ b/ReactiveObjCTests/RACKVOWrapperSpec.m @@ -571,6 +571,8 @@ + (void)configure:(Configuration *)configuration { __weak id identifier = nil; @autoreleasepool { + expect(targetClass).notTo(beNil()); + // Create an observable target that we control the memory management of. CFTypeRef target = CFBridgingRetain([[targetClass alloc] init]); expect((__bridge id)target).notTo(beNil()); diff --git a/ReactiveObjCTests/RACMulticastConnectionSpec.m b/ReactiveObjCTests/RACMulticastConnectionSpec.m index 5ce04ba5f..2d0abc0be 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/RACSchedulerSpec.m b/ReactiveObjCTests/RACSchedulerSpec.m index 754a8c83e..0199d46d5 100644 --- a/ReactiveObjCTests/RACSchedulerSpec.m +++ b/ReactiveObjCTests/RACSchedulerSpec.m @@ -15,7 +15,6 @@ #import "RACDisposable.h" #import #import "RACTestExampleScheduler.h" -#import // This shouldn't be used directly. Use the `expectCurrentSchedulers` block // below instead. diff --git a/ReactiveObjCTests/RACSignalSpec.m b/ReactiveObjCTests/RACSignalSpec.m index bc65fd547..8c472b68c 100644 --- a/ReactiveObjCTests/RACSignalSpec.m +++ b/ReactiveObjCTests/RACSignalSpec.m @@ -33,7 +33,7 @@ #import "RACTestScheduler.h" #import "RACTuple.h" #import "RACUnit.h" -#import +#import // Set in a beforeAll below. static NSError *RACSignalTestError; @@ -111,7 +111,7 @@ + (void)configure:(Configuration *)configuration { }; RACSignal *infiniteSignal = [RACSignal createSignal:^(id subscriber) { - __block volatile int32_t done = 0; + __block atomic_int done = 0; [RACScheduler.mainThreadScheduler schedule:^{ while (!done) { @@ -120,7 +120,7 @@ + (void)configure:(Configuration *)configuration { }]; return [RACDisposable disposableWithBlock:^{ - OSAtomicIncrement32Barrier(&done); + atomic_fetch_add(&done, 1); }]; }]; diff --git a/ReactiveObjCTests/RACSubjectSpec.m b/ReactiveObjCTests/RACSubjectSpec.m index bfe56a5b5..5e2a827aa 100644 --- a/ReactiveObjCTests/RACSubjectSpec.m +++ b/ReactiveObjCTests/RACSubjectSpec.m @@ -11,7 +11,7 @@ #import "RACSubscriberExamples.h" -#import +#import #import #import "RACBehaviorSubject.h" #import "RACCompoundDisposable.h" @@ -255,10 +255,10 @@ - (void)didSubscribeWithDisposable:(RACCompoundDisposable *)disposable { // Just leak it, ain't no thang. __unsafe_unretained volatile id *values = (__unsafe_unretained id *)calloc(count, sizeof(*values)); - __block volatile int32_t nextIndex = 0; + __block atomic_int nextIndex = 0; [subject subscribeNext:^(NSNumber *value) { - int32_t indexPlusOne = OSAtomicIncrement32(&nextIndex); + int32_t indexPlusOne = atomic_fetch_add(&nextIndex, 1) + 1; values[indexPlusOne - 1] = value; }]; @@ -276,7 +276,7 @@ - (void)didSubscribeWithDisposable:(RACCompoundDisposable *)disposable { [subject sendCompleted]; }); - OSMemoryBarrier(); + atomic_thread_fence(memory_order_seq_cst); NSArray *liveValues = [NSArray arrayWithObjects:(id *)values count:(NSUInteger)nextIndex]; expect(liveValues).to(haveCount(@(count))); diff --git a/ReactiveObjCTests/RACSubscriberSpec.m b/ReactiveObjCTests/RACSubscriberSpec.m index 0ff9fba90..834db099b 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 c112bcd4a..6b12c9421 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 index d8a32b3f7..a1bcfba43 100644 --- a/ReactiveObjCTests/UIActionSheetRACSupportSpec.m +++ b/ReactiveObjCTests/UIActionSheetRACSupportSpec.m @@ -5,6 +5,7 @@ // Created by Dave Lee on 2013-06-22. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 @import Quick; @import Nimble; @@ -37,3 +38,5 @@ }); QuickSpecEnd + +#endif diff --git a/ReactiveObjCTests/UIAlertViewRACSupportSpec.m b/ReactiveObjCTests/UIAlertViewRACSupportSpec.m index 6321094aa..fa77a49cf 100644 --- a/ReactiveObjCTests/UIAlertViewRACSupportSpec.m +++ b/ReactiveObjCTests/UIAlertViewRACSupportSpec.m @@ -5,6 +5,7 @@ // Created by Henrik Hodne on 6/16/13. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 @import Quick; @import Nimble; @@ -45,3 +46,5 @@ }); QuickSpecEnd + +#endif