From 8570f0303ed51f82c3eced5430586bd1b48c7976 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Wed, 18 Feb 2026 13:51:15 -0300 Subject: [PATCH 1/2] Remove redundant nullability annotations These files already have NS_ASSUME_NONNULL_BEGIN/END regions, so explicit nonnull, __nonnull, and _Nonnull annotations on declarations within those regions are redundant and can be removed. Co-Authored-By: Claude Opus 4.6 --- Source/PrivateHeaders/Ably/ARTBaseMessage+Private.h | 4 ++-- Source/PrivateHeaders/Ably/ARTRealtime+Private.h | 4 ++-- Source/PrivateHeaders/Ably/ARTRealtimePresence+Private.h | 2 +- Source/PrivateHeaders/Ably/ARTRest+Private.h | 4 ++-- Source/include/Ably/ARTStringifiable.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/PrivateHeaders/Ably/ARTBaseMessage+Private.h b/Source/PrivateHeaders/Ably/ARTBaseMessage+Private.h index 7cc4de85b..389975e72 100644 --- a/Source/PrivateHeaders/Ably/ARTBaseMessage+Private.h +++ b/Source/PrivateHeaders/Ably/ARTBaseMessage+Private.h @@ -9,8 +9,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) BOOL isIdEmpty; -- (id __nonnull)decodeWithEncoder:(ARTDataEncoder*)encoder error:(NSError *__nullable*__nullable)error; -- (id __nonnull)encodeWithEncoder:(ARTDataEncoder*)encoder error:(NSError *__nullable*__nullable)error; +- (id)decodeWithEncoder:(ARTDataEncoder *)encoder error:(NSError *_Nullable *_Nullable)error; +- (id)encodeWithEncoder:(ARTDataEncoder *)encoder error:(NSError *_Nullable *_Nullable)error; @end diff --git a/Source/PrivateHeaders/Ably/ARTRealtime+Private.h b/Source/PrivateHeaders/Ably/ARTRealtime+Private.h index 21eb3d78c..ddc7989bb 100644 --- a/Source/PrivateHeaders/Ably/ARTRealtime+Private.h +++ b/Source/PrivateHeaders/Ably/ARTRealtime+Private.h @@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN @property (readonly) ARTAuthInternal *auth; @property (readonly) ARTPushInternal *push; #if TARGET_OS_IOS -@property (nonnull, nonatomic, readonly, getter=device) ARTLocalDevice *device; +@property (nonatomic, readonly, getter=device) ARTLocalDevice *device; #endif @property (readonly, nullable, getter=clientId) NSString *clientId; @@ -105,7 +105,7 @@ wrapperSDKAgents:(nullable NSStringDictionary *)wrapperSDKAgents @property (readwrite, nonatomic) ARTRestInternal *rest; @property (readonly, nullable) id transport; -@property (readonly, nonatomic, nonnull) id reachability; +@property (readonly, nonatomic) id reachability; @property (nonatomic) NSTimeInterval connectionStateTtl; @property (nonatomic) NSTimeInterval maxIdleInterval; diff --git a/Source/PrivateHeaders/Ably/ARTRealtimePresence+Private.h b/Source/PrivateHeaders/Ably/ARTRealtimePresence+Private.h index f3839eac2..127d904cb 100644 --- a/Source/PrivateHeaders/Ably/ARTRealtimePresence+Private.h +++ b/Source/PrivateHeaders/Ably/ARTRealtimePresence+Private.h @@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN @property (readonly, nonatomic) BOOL syncInProgress; - (instancetype)init UNAVAILABLE_ATTRIBUTE; -- (instancetype)initWithQueue:(_Nonnull dispatch_queue_t)queue logger:(ARTInternalLog *)logger; +- (instancetype)initWithQueue:(dispatch_queue_t)queue logger:(ARTInternalLog *)logger; - (void)processMember:(ARTPresenceMessage *)message; - (void)reset; diff --git a/Source/PrivateHeaders/Ably/ARTRest+Private.h b/Source/PrivateHeaders/Ably/ARTRest+Private.h index 30bfe1728..5c2ce3cac 100644 --- a/Source/PrivateHeaders/Ably/ARTRest+Private.h +++ b/Source/PrivateHeaders/Ably/ARTRest+Private.h @@ -25,8 +25,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) ARTAuthInternal *auth; @property (nonatomic, readonly) ARTPushInternal *push; #if TARGET_OS_IOS -@property (nonnull, nonatomic, readonly, getter=device) ARTLocalDevice *device; -@property (nonnull, nonatomic, readonly, getter=device_nosync) ARTLocalDevice *device_nosync; +@property (nonatomic, readonly, getter=device) ARTLocalDevice *device; +@property (nonatomic, readonly, getter=device_nosync) ARTLocalDevice *device_nosync; @property (nonatomic) id storage; #endif diff --git a/Source/include/Ably/ARTStringifiable.h b/Source/include/Ably/ARTStringifiable.h index 8f598fd6d..485098dd8 100644 --- a/Source/include/Ably/ARTStringifiable.h +++ b/Source/include/Ably/ARTStringifiable.h @@ -8,7 +8,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init UNAVAILABLE_ATTRIBUTE; -@property(nonnull, nonatomic, readonly) NSString* stringValue; +@property(nonatomic, readonly) NSString* stringValue; + (ARTStringifiable*)withString:(NSString *)value; + (ARTStringifiable*)withNumber:(NSNumber *)value; From dd707420b111b89d653433a1a09988a7a2ee30c3 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Wed, 18 Feb 2026 13:51:34 -0300 Subject: [PATCH 2/2] Add NS_ASSUME_NONNULL to all headers and .m @interface declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds NS_ASSUME_NONNULL_BEGIN/END to every header and .m @interface declaration that was missing it, improving Swift bridging (nonnull types bridge as non-optional) and making the nullability contract explicit for human readers. Some of the wrapped declarations don't currently contain pointer types, but are included for consistency and so that future additions to those interfaces will have coverage by default. Where adding coverage made existing explicit nonnull annotations redundant, those are removed. Where a return type or parameter is genuinely nullable (verified by reading the implementation), an explicit nullable annotation is added — notably on the dictionary lookup helpers in ARTNSDictionary+ARTDictionaryUtil.h and parseId in ARTPresenceMessage+Private.h. In ARTTypes.h, NS_ASSUME_NONNULL_BEGIN is moved earlier to cover the *ToStr() C functions that were previously annotated with inline _Nonnull. Co-Authored-By: Claude Opus 4.6 --- Source/ARTChannels.m | 4 ++++ Source/ARTClientOptions.m | 4 ++++ Source/ARTContinuousClock.m | 4 ++++ Source/ARTCrypto.m | 4 ++++ Source/ARTEventEmitter.m | 4 ++++ Source/ARTFallback.m | 4 ++++ Source/ARTGCD.m | 4 ++++ Source/ARTHttp.m | 4 ++++ Source/ARTLocalDevice.m | 4 ++++ Source/ARTRealtime.m | 4 ++++ Source/ARTRealtimeAnnotations.m | 6 +++++- Source/ARTRealtimeChannel.m | 4 ++-- Source/ARTRealtimeChannels.m | 4 ++++ Source/ARTSummaryTypes.m | 6 ++++++ Source/ARTTypes.m | 4 ++++ Source/ARTURLSessionServerTrust.m | 4 ++++ .../Ably/ARTChannelOptions+Private.h | 4 ++++ Source/PrivateHeaders/Ably/ARTConstants.h | 4 ++++ .../PrivateHeaders/Ably/ARTDefault+Private.h | 4 ++++ Source/PrivateHeaders/Ably/ARTJsonEncoder.h | 4 ++++ Source/PrivateHeaders/Ably/ARTMsgPackEncoder.h | 4 ++++ .../Ably/ARTNSArray+ARTFunctional.h | 8 ++++++-- Source/PrivateHeaders/Ably/ARTNSDate+ARTUtil.h | 4 ++++ .../Ably/ARTNSDictionary+ARTDictionaryUtil.h | 18 +++++++++++------- .../PrivateHeaders/Ably/ARTNSString+ARTUtil.h | 6 +++++- Source/PrivateHeaders/Ably/ARTOSReachability.h | 4 ++++ .../PrivateHeaders/Ably/ARTPresence+Private.h | 4 ++++ .../Ably/ARTPresenceMessage+Private.h | 6 +++++- .../Ably/ARTStringifiable+Private.h | 12 ++++++++---- .../Ably/ARTTokenParams+Private.h | 4 ++++ Source/include/Ably/ARTChannels.h | 4 ++++ Source/include/Ably/ARTPresenceMessage.h | 10 +++++----- Source/include/Ably/ARTTypes.h | 14 +++++++------- Test/AblyTests/Tests/AuthTests.swift | 2 +- 34 files changed, 153 insertions(+), 31 deletions(-) diff --git a/Source/ARTChannels.m b/Source/ARTChannels.m index 3c209dd6f..6d21e0bfd 100644 --- a/Source/ARTChannels.m +++ b/Source/ARTChannels.m @@ -6,6 +6,8 @@ #import "ARTRestChannel.h" #import "ARTGCD.h" +NS_ASSUME_NONNULL_BEGIN + @interface ARTChannels() { __weak id _delegate; // weak because delegates outlive their counterpart dispatch_queue_t _queue; @@ -13,6 +15,8 @@ @interface ARTChannels() { @end +NS_ASSUME_NONNULL_END + @implementation ARTChannels - (instancetype)initWithDelegate:(id)delegate dispatchQueue:(dispatch_queue_t)queue prefix:(NSString *)prefix { diff --git a/Source/ARTClientOptions.m b/Source/ARTClientOptions.m index 9b09e03e1..02e7a03ee 100644 --- a/Source/ARTClientOptions.m +++ b/Source/ARTClientOptions.m @@ -18,6 +18,8 @@ NSString *ARTDefaultEnvironment = nil; +NS_ASSUME_NONNULL_BEGIN + @interface ARTClientOptions () @property (nonatomic) NSMutableDictionary *pluginData; @@ -26,6 +28,8 @@ - (instancetype)initDefaults; @end +NS_ASSUME_NONNULL_END + @implementation ARTClientOptions - (instancetype)initDefaults { diff --git a/Source/ARTContinuousClock.m b/Source/ARTContinuousClock.m index 4e9dff663..50b999962 100644 --- a/Source/ARTContinuousClock.m +++ b/Source/ARTContinuousClock.m @@ -1,5 +1,7 @@ #import "ARTContinuousClock.h" +NS_ASSUME_NONNULL_BEGIN + @interface ARTContinuousClockInstant () - (instancetype)initWithTime:(uint64_t)time NS_DESIGNATED_INITIALIZER; @@ -13,6 +15,8 @@ - (instancetype)initWithTime:(uint64_t)time NS_DESIGNATED_INITIALIZER; @end +NS_ASSUME_NONNULL_END + @implementation ARTContinuousClock - (ARTContinuousClockInstant *)now { diff --git a/Source/ARTCrypto.m b/Source/ARTCrypto.m index 6fd39fd51..00007bef7 100644 --- a/Source/ARTCrypto.m +++ b/Source/ARTCrypto.m @@ -5,6 +5,8 @@ #define ART_CBC_BLOCK_LENGTH (16) +NS_ASSUME_NONNULL_BEGIN + @interface ARTCipherParams () - (BOOL)ccAlgorithm:(CCAlgorithm *)algorithm error:(NSError **)error; @@ -17,6 +19,8 @@ @interface ARTCbcCipher () @end +NS_ASSUME_NONNULL_END + @implementation NSString (ARTCipherKeyCompatible) - (NSData *)toData { diff --git a/Source/ARTEventEmitter.m b/Source/ARTEventEmitter.m index 04fc234dd..ece4332aa 100644 --- a/Source/ARTEventEmitter.m +++ b/Source/ARTEventEmitter.m @@ -46,12 +46,16 @@ - (NSString *)identification { #pragma mark - ARTEventListener +NS_ASSUME_NONNULL_BEGIN + @interface ARTEventListener () @property (readonly) BOOL invalidated; @property (readonly) BOOL timerIsRunning; @property (readonly) BOOL hasTimer; @end +NS_ASSUME_NONNULL_END + @implementation ARTEventListener { NSNotificationCenter *_center; __weak ARTEventEmitter *_eventHandler; // weak because eventEmitter owns self diff --git a/Source/ARTFallback.m b/Source/ARTFallback.m index 88888b842..00258c740 100644 --- a/Source/ARTFallback.m +++ b/Source/ARTFallback.m @@ -10,10 +10,14 @@ } }; +NS_ASSUME_NONNULL_BEGIN + @interface ARTFallback () @end +NS_ASSUME_NONNULL_END + @implementation ARTFallback - (instancetype)initWithFallbackHosts:(nullable NSArray *)fallbackHosts shuffleArray:(void (^)(NSMutableArray *))shuffleArray { diff --git a/Source/ARTGCD.m b/Source/ARTGCD.m index 7549cf8a5..67c60683d 100644 --- a/Source/ARTGCD.m +++ b/Source/ARTGCD.m @@ -1,5 +1,7 @@ #import "ARTGCD.h" +NS_ASSUME_NONNULL_BEGIN + @interface ARTScheduledBlockHandle () // Mark this as `atomic` to syncronize access to it from `_scheduledBlock` and `cancel`. @@ -7,6 +9,8 @@ @interface ARTScheduledBlockHandle () @end +NS_ASSUME_NONNULL_END + @implementation ARTScheduledBlockHandle { dispatch_block_t _scheduledBlock; } diff --git a/Source/ARTHttp.m b/Source/ARTHttp.m index 350b28224..f14ec4845 100644 --- a/Source/ARTHttp.m +++ b/Source/ARTHttp.m @@ -3,12 +3,16 @@ #import "ARTConstants.h" #import "ARTInternalLog.h" +NS_ASSUME_NONNULL_BEGIN + @interface ARTHttp () @property (readonly, nonatomic) id urlSession; @end +NS_ASSUME_NONNULL_END + Class configuredUrlSessionClass = nil; #pragma mark - ARTHttp diff --git a/Source/ARTLocalDevice.m b/Source/ARTLocalDevice.m index 8dd5cdebd..6b0eae83a 100644 --- a/Source/ARTLocalDevice.m +++ b/Source/ARTLocalDevice.m @@ -40,12 +40,16 @@ return [ARTAPNSDeviceTokenKey stringByAppendingFormat:@"-%@", tokenType ?: ARTAPNSDeviceDefaultTokenType]; } +NS_ASSUME_NONNULL_BEGIN + @interface ARTLocalDevice () @property (nullable, nonatomic, readonly) ARTInternalLog *logger; @end +NS_ASSUME_NONNULL_END + @implementation ARTLocalDevice - (instancetype)initWithStorage:(id)storage logger:(nullable ARTInternalLog *)logger { diff --git a/Source/ARTRealtime.m b/Source/ARTRealtime.m index fb567d290..e90e13d7a 100644 --- a/Source/ARTRealtime.m +++ b/Source/ARTRealtime.m @@ -57,12 +57,16 @@ #import "ARTWrapperSDKProxyRealtime+Private.h" #import "ARTConnectionDetails+Private.h" +NS_ASSUME_NONNULL_BEGIN + @interface ARTConnectionStateChange () - (void)setRetryIn:(NSTimeInterval)retryIn; @end +NS_ASSUME_NONNULL_END + #pragma mark - ARTRealtime implementation @implementation ARTRealtime { diff --git a/Source/ARTRealtimeAnnotations.m b/Source/ARTRealtimeAnnotations.m index b6c0defee..9aa7a0ded 100644 --- a/Source/ARTRealtimeAnnotations.m +++ b/Source/ARTRealtimeAnnotations.m @@ -79,12 +79,16 @@ - (void)unsubscribe:(NSString *)type listener:(ARTEventListener *)listener { #pragma mark - ARTRealtimeAnnotationsInternal +NS_ASSUME_NONNULL_BEGIN + @interface ARTRealtimeAnnotationsInternal () -@property (nonnull, nonatomic, readonly) ARTInternalLog *logger; +@property (nonatomic, readonly) ARTInternalLog *logger; @end +NS_ASSUME_NONNULL_END + @implementation ARTRealtimeAnnotationsInternal { __weak ARTRealtimeChannelInternal *_channel; // weak because channel owns self __weak ARTRealtimeInternal *_realtime; diff --git a/Source/ARTRealtimeChannel.m b/Source/ARTRealtimeChannel.m index a80d26e20..0671083de 100644 --- a/Source/ARTRealtimeChannel.m +++ b/Source/ARTRealtimeChannel.m @@ -269,6 +269,8 @@ - (void)setOptions:(ARTRealtimeChannelOptions *_Nullable)options callback:(nulla @end +NS_ASSUME_NONNULL_BEGIN + @interface ARTRealtimeChannelInternal () { ARTRealtimePresenceInternal *_realtimePresence; ARTRealtimeAnnotationsInternal *_realtimeAnnotations; @@ -285,8 +287,6 @@ @interface ARTRealtimeChannelInternal () { @end -NS_ASSUME_NONNULL_BEGIN - @interface ARTRealtimeChannelInternal () @property (nonatomic, readonly) ARTAttachRetryState *attachRetryState; diff --git a/Source/ARTRealtimeChannels.m b/Source/ARTRealtimeChannels.m index cab70f67a..753d8db3c 100644 --- a/Source/ARTRealtimeChannels.m +++ b/Source/ARTRealtimeChannels.m @@ -50,6 +50,8 @@ - (void)release:(NSString *)name { @end +NS_ASSUME_NONNULL_BEGIN + @interface ARTRealtimeChannelsInternal () @property (nonatomic, readonly) ARTInternalLog *logger; @@ -60,6 +62,8 @@ @interface ARTRealtimeChannelsInternal () @interface ARTRealtimeChannelsInternal () @end +NS_ASSUME_NONNULL_END + @implementation ARTRealtimeChannelsInternal { ARTChannels *_channels; dispatch_queue_t _userQueue; diff --git a/Source/ARTSummaryTypes.m b/Source/ARTSummaryTypes.m index 9e85f9472..6039e1228 100644 --- a/Source/ARTSummaryTypes.m +++ b/Source/ARTSummaryTypes.m @@ -3,8 +3,10 @@ #import "ARTNSDictionary+ARTDictionaryUtil.h" #import "ARTMessageAnnotations.h" +NS_ASSUME_NONNULL_BEGIN @interface ARTSummaryClientIdList () @end +NS_ASSUME_NONNULL_END @implementation ARTSummaryClientIdList @@ -75,8 +77,10 @@ - (NSString *)description { @end +NS_ASSUME_NONNULL_BEGIN @interface ARTSummaryClientIdCounts () @end +NS_ASSUME_NONNULL_END @implementation ARTSummaryClientIdCounts @@ -173,8 +177,10 @@ - (NSString *)description { @end +NS_ASSUME_NONNULL_BEGIN @interface ARTSummaryTotal () @end +NS_ASSUME_NONNULL_END @implementation ARTSummaryTotal diff --git a/Source/ARTTypes.m b/Source/ARTTypes.m index 35d32e82f..f7d5bc725 100644 --- a/Source/ARTTypes.m +++ b/Source/ARTTypes.m @@ -384,6 +384,8 @@ + (NSDate *)art_dateWithMillisecondsSince1970:(uint64_t)msecs { @end +NS_ASSUME_NONNULL_BEGIN + @interface ARTCancellableFromCallback : NSObject +(instancetype)new NS_UNAVAILABLE; -(instancetype)init NS_UNAVAILABLE; @@ -391,6 +393,8 @@ -(instancetype)initWithCallback:(ARTResultCallback)callback; @property(nonatomic, readonly) ARTResultCallback wrapper; @end +NS_ASSUME_NONNULL_END + @implementation ARTCancellableFromCallback { id _lock; diff --git a/Source/ARTURLSessionServerTrust.m b/Source/ARTURLSessionServerTrust.m index b90653a20..2e74720c0 100644 --- a/Source/ARTURLSessionServerTrust.m +++ b/Source/ARTURLSessionServerTrust.m @@ -1,6 +1,8 @@ #import "ARTURLSessionServerTrust.h" #import "ARTGCD.h" +NS_ASSUME_NONNULL_BEGIN + @interface ARTURLSessionServerTrust() { NSURLSession *_session; dispatch_queue_t _queue; @@ -8,6 +10,8 @@ @interface ARTURLSessionServerTrust() { @end +NS_ASSUME_NONNULL_END + @implementation ARTURLSessionServerTrust - (instancetype)init:(dispatch_queue_t)queue { diff --git a/Source/PrivateHeaders/Ably/ARTChannelOptions+Private.h b/Source/PrivateHeaders/Ably/ARTChannelOptions+Private.h index 5bb3101b5..0b4d77c84 100644 --- a/Source/PrivateHeaders/Ably/ARTChannelOptions+Private.h +++ b/Source/PrivateHeaders/Ably/ARTChannelOptions+Private.h @@ -1,8 +1,12 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + @interface ARTChannelOptions () @property (nonatomic, getter=isFrozen) BOOL frozen; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTConstants.h b/Source/PrivateHeaders/Ably/ARTConstants.h index 248ab8d5f..98d5be489 100644 --- a/Source/PrivateHeaders/Ably/ARTConstants.h +++ b/Source/PrivateHeaders/Ably/ARTConstants.h @@ -1,5 +1,9 @@ #import +NS_ASSUME_NONNULL_BEGIN + extern NSString *const ARTHttpHeaderFieldErrorCodeKey; extern NSString *const ARTHttpHeaderFieldErrorMessageKey; extern NSUInteger const ARTIdempotentLibraryGeneratedIdLength; + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTDefault+Private.h b/Source/PrivateHeaders/Ably/ARTDefault+Private.h index 328326353..2cc19e50a 100644 --- a/Source/PrivateHeaders/Ably/ARTDefault+Private.h +++ b/Source/PrivateHeaders/Ably/ARTDefault+Private.h @@ -1,5 +1,7 @@ #import +NS_ASSUME_NONNULL_BEGIN + extern NSString *const ARTDefaultProduction; @interface ARTDefault (Private) @@ -11,3 +13,5 @@ extern NSString *const ARTDefaultProduction; + (NSInteger)maxProductionMessageSize; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTJsonEncoder.h b/Source/PrivateHeaders/Ably/ARTJsonEncoder.h index f2dd6e248..52b2e2df1 100644 --- a/Source/PrivateHeaders/Ably/ARTJsonEncoder.h +++ b/Source/PrivateHeaders/Ably/ARTJsonEncoder.h @@ -2,6 +2,10 @@ #import "ARTJsonLikeEncoder.h" +NS_ASSUME_NONNULL_BEGIN + @interface ARTJsonEncoder : NSObject @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTMsgPackEncoder.h b/Source/PrivateHeaders/Ably/ARTMsgPackEncoder.h index 34b0ffc48..86f1252ec 100644 --- a/Source/PrivateHeaders/Ably/ARTMsgPackEncoder.h +++ b/Source/PrivateHeaders/Ably/ARTMsgPackEncoder.h @@ -2,6 +2,10 @@ #import "ARTJsonLikeEncoder.h" +NS_ASSUME_NONNULL_BEGIN + @interface ARTMsgPackEncoder : NSObject @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTNSArray+ARTFunctional.h b/Source/PrivateHeaders/Ably/ARTNSArray+ARTFunctional.h index a4be924a0..583362185 100644 --- a/Source/PrivateHeaders/Ably/ARTNSArray+ARTFunctional.h +++ b/Source/PrivateHeaders/Ably/ARTNSArray+ARTFunctional.h @@ -1,8 +1,12 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface NSArray (ARTFunctional) -- (NSArray *)artMap:(id(^)(id))f; -- (NSArray *)artFilter:(BOOL(^)(id))f; +- (NSArray *)artMap:(id (^)(id))f; +- (NSArray *)artFilter:(BOOL (^)(id))f; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTNSDate+ARTUtil.h b/Source/PrivateHeaders/Ably/ARTNSDate+ARTUtil.h index 23d8efb35..eaf579191 100644 --- a/Source/PrivateHeaders/Ably/ARTNSDate+ARTUtil.h +++ b/Source/PrivateHeaders/Ably/ARTNSDate+ARTUtil.h @@ -1,5 +1,7 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface NSDate (ARTUtil) + (instancetype)artDateFromNumberMs:(NSNumber *)number; @@ -9,3 +11,5 @@ - (NSInteger)artToIntegerMs; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTNSDictionary+ARTDictionaryUtil.h b/Source/PrivateHeaders/Ably/ARTNSDictionary+ARTDictionaryUtil.h index 9f72f2ed3..7bd9c14c0 100644 --- a/Source/PrivateHeaders/Ably/ARTNSDictionary+ARTDictionaryUtil.h +++ b/Source/PrivateHeaders/Ably/ARTNSDictionary+ARTDictionaryUtil.h @@ -1,22 +1,26 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface NSDictionary (ARTDictionaryUtil) -- (NSString *)artString:(id)key; -- (NSNumber *)artNumber:(id)key; -- (NSDate *)artTimestamp:(id)key; -- (NSArray *)artArray:(id)key; -- (NSDictionary *)artDictionary:(id)key; +- (nullable NSString *)artString:(id)key; +- (nullable NSNumber *)artNumber:(id)key; +- (nullable NSDate *)artTimestamp:(id)key; +- (nullable NSArray *)artArray:(id)key; +- (nullable NSDictionary *)artDictionary:(id)key; - (NSInteger)artInteger:(id)key; - (BOOL)artBoolean:(id)key; -- (id)artTyped:(Class)cls key:(id)key; +- (nullable id)artTyped:(Class)cls key:(id)key; /** * Maps dictionary values using the provided block function. * @param f Block function that transforms each value * @return New dictionary with transformed values */ -- (NSDictionary *)artMap:(id(^)(id key, id value))f; +- (NSDictionary *)artMap:(id _Nullable (^)(id key, id value))f; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTNSString+ARTUtil.h b/Source/PrivateHeaders/Ably/ARTNSString+ARTUtil.h index 515e5797a..c15b832fe 100644 --- a/Source/PrivateHeaders/Ably/ARTNSString+ARTUtil.h +++ b/Source/PrivateHeaders/Ably/ARTNSString+ARTUtil.h @@ -2,10 +2,14 @@ #define NSStringFromBOOL(aBOOL) ((aBOOL) ? @"YES" : @"NO") +NS_ASSUME_NONNULL_BEGIN + @interface NSString (ARTUtil) -+ (NSString *)nilToEmpty:(NSString*)aString; ++ (NSString *)nilToEmpty:(nullable NSString *)aString; - (BOOL)isEmptyString; - (BOOL)isNotEmptyString; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTOSReachability.h b/Source/PrivateHeaders/Ably/ARTOSReachability.h index b216a3e43..8ef406023 100644 --- a/Source/PrivateHeaders/Ably/ARTOSReachability.h +++ b/Source/PrivateHeaders/Ably/ARTOSReachability.h @@ -1,4 +1,8 @@ #import "ARTReachability.h" +NS_ASSUME_NONNULL_BEGIN + @interface ARTOSReachability : NSObject @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTPresence+Private.h b/Source/PrivateHeaders/Ably/ARTPresence+Private.h index 2ed287257..230cc98a4 100644 --- a/Source/PrivateHeaders/Ably/ARTPresence+Private.h +++ b/Source/PrivateHeaders/Ably/ARTPresence+Private.h @@ -1,6 +1,8 @@ #import #import "ARTChannel.h" +NS_ASSUME_NONNULL_BEGIN + @interface ARTPresenceQuery () - (NSMutableArray *)asQueryItems; @@ -14,3 +16,5 @@ - (instancetype)initWithChannel:(ARTChannel *)channel; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTPresenceMessage+Private.h b/Source/PrivateHeaders/Ably/ARTPresenceMessage+Private.h index ca1f97307..b844f7f2b 100644 --- a/Source/PrivateHeaders/Ably/ARTPresenceMessage+Private.h +++ b/Source/PrivateHeaders/Ably/ARTPresenceMessage+Private.h @@ -1,5 +1,7 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface ARTPresenceMessage () /** @@ -7,8 +9,10 @@ */ - (BOOL)isSynthesized; -- (NSArray *)parseId; +- (nullable NSArray *)parseId; - (NSInteger)msgSerialFromId; - (NSInteger)indexFromId; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTStringifiable+Private.h b/Source/PrivateHeaders/Ably/ARTStringifiable+Private.h index d2fdbc941..2dd213164 100644 --- a/Source/PrivateHeaders/Ably/ARTStringifiable+Private.h +++ b/Source/PrivateHeaders/Ably/ARTStringifiable+Private.h @@ -1,9 +1,13 @@ #import -@interface ARTStringifiable() +NS_ASSUME_NONNULL_BEGIN -- (nonnull instancetype)initWithString:(nonnull NSString *)value; -- (nonnull instancetype)initWithNumber:(nonnull NSNumber *)value; -- (nonnull instancetype)initWithBool:(BOOL)value; +@interface ARTStringifiable () + +- (instancetype)initWithString:(NSString *)value; +- (instancetype)initWithNumber:(NSNumber *)value; +- (instancetype)initWithBool:(BOOL)value; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/PrivateHeaders/Ably/ARTTokenParams+Private.h b/Source/PrivateHeaders/Ably/ARTTokenParams+Private.h index 07e4b47b8..d5fc8d4c3 100644 --- a/Source/PrivateHeaders/Ably/ARTTokenParams+Private.h +++ b/Source/PrivateHeaders/Ably/ARTTokenParams+Private.h @@ -1,8 +1,12 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface ARTTokenParams (Private) - (ARTTokenRequest *)sign:(NSString *)key; - (ARTTokenRequest *)sign:(NSString *)key withNonce:(NSString *)nonce; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/include/Ably/ARTChannels.h b/Source/include/Ably/ARTChannels.h index 19a18693e..f1550c14f 100644 --- a/Source/include/Ably/ARTChannels.h +++ b/Source/include/Ably/ARTChannels.h @@ -4,6 +4,8 @@ @class ARTRestChannel; @class ARTChannelOptions; +NS_ASSUME_NONNULL_BEGIN + /** * Creates and destroys `ARTRestChannel` and `ARTRealtimeChannel` objects. */ @@ -50,3 +52,5 @@ NS_SWIFT_SENDABLE - (id)copyIntoIteratorWithMapper:(id (^)(ChannelType))mapper; @end + +NS_ASSUME_NONNULL_END diff --git a/Source/include/Ably/ARTPresenceMessage.h b/Source/include/Ably/ARTPresenceMessage.h index c5bf7bd9a..f234e6d53 100644 --- a/Source/include/Ably/ARTPresenceMessage.h +++ b/Source/include/Ably/ARTPresenceMessage.h @@ -28,11 +28,11 @@ typedef NS_ENUM(NSUInteger, ARTPresenceAction) { ARTPresenceUpdate }; -/// :nodoc: -NSString *_Nonnull ARTPresenceActionToStr(ARTPresenceAction action); - NS_ASSUME_NONNULL_BEGIN +/// :nodoc: +NSString *ARTPresenceActionToStr(ARTPresenceAction action); + /** * Contains an individual presence update sent to, or received from, Ably. */ @@ -48,10 +48,10 @@ NS_ASSUME_NONNULL_BEGIN * * @return A combination of `ARTBaseMessage.clientId` and `ARTBaseMessage.connectionId`. */ -- (nonnull NSString *)memberKey; +- (NSString *)memberKey; /// :nodoc: -- (BOOL)isEqualToPresenceMessage:(nonnull ARTPresenceMessage *)presence; +- (BOOL)isEqualToPresenceMessage:(ARTPresenceMessage *)presence; @end diff --git a/Source/include/Ably/ARTTypes.h b/Source/include/Ably/ARTTypes.h index f594c5fbb..6a8e0f14b 100644 --- a/Source/include/Ably/ARTTypes.h +++ b/Source/include/Ably/ARTTypes.h @@ -92,8 +92,10 @@ typedef NS_ENUM(NSUInteger, ARTRealtimeConnectionState) { ARTRealtimeFailed }; +NS_ASSUME_NONNULL_BEGIN + /// :nodoc: -NSString *_Nonnull ARTRealtimeConnectionStateToStr(ARTRealtimeConnectionState state); +NSString *ARTRealtimeConnectionStateToStr(ARTRealtimeConnectionState state); /** * Describes the events emitted by a `ARTConnection` object. An event is either an `ARTRealtimeConnectionEventUpdate` or an `ARTRealtimeConnectionState`. @@ -115,7 +117,7 @@ typedef NS_ENUM(NSUInteger, ARTRealtimeConnectionEvent) { }; /// :nodoc: -NSString *_Nonnull ARTRealtimeConnectionEventToStr(ARTRealtimeConnectionEvent event); +NSString *ARTRealtimeConnectionEventToStr(ARTRealtimeConnectionEvent event); /** * Describes the possible states of an `ARTRealtimeChannel` object. @@ -153,7 +155,7 @@ typedef NS_ENUM(NSUInteger, ARTRealtimeChannelState) { }; /// :nodoc: -NSString *_Nonnull ARTRealtimeChannelStateToStr(ARTRealtimeChannelState state); +NSString *ARTRealtimeChannelStateToStr(ARTRealtimeChannelState state); /** * Describes the events emitted by an `ARTRealtimeChannel` object. An event is either an `ARTChannelEventUpdate` or a `ARTRealtimeChannelState`. @@ -174,7 +176,7 @@ typedef NS_ENUM(NSUInteger, ARTChannelEvent) { }; /// :nodoc: -NSString *_Nonnull ARTChannelEventToStr(ARTChannelEvent event); +NSString *ARTChannelEventToStr(ARTChannelEvent event); /// :nodoc: @@ -201,8 +203,6 @@ typedef NS_ENUM(NSInteger, ARTCustomRequestError) { ARTCustomRequestErrorInvalidPath = 3, }; -NS_ASSUME_NONNULL_BEGIN - /// :nodoc: /// Decompose API key NSArray *decomposeKey(NSString *key); @@ -582,6 +582,6 @@ typedef void (^ARTPublishResultCallback)(ARTPublishResult *_Nullable result, ART * * To make use of these benefits the caller needs to use the returned wrapper to invoke the callback. The wrapper will only work for as long as the returned instance remains allocated (i.e. has a strong reference to it somewhere). */ -NSObject * artCancellableFromCallback(ARTResultCallback callback, _Nonnull ARTResultCallback *_Nonnull wrapper); +NSObject * artCancellableFromCallback(ARTResultCallback callback, _Nonnull ARTResultCallback * _Nonnull wrapper); NS_ASSUME_NONNULL_END diff --git a/Test/AblyTests/Tests/AuthTests.swift b/Test/AblyTests/Tests/AuthTests.swift index 5a4318bf0..05b82a845 100644 --- a/Test/AblyTests/Tests/AuthTests.swift +++ b/Test/AblyTests/Tests/AuthTests.swift @@ -2466,7 +2466,7 @@ class AuthTests: XCTestCase { XCTFail("TokenRequest is nil"); done(); return } let signed = tokenParams.sign(rest.internal.options.key!, withNonce: tokenRequest1.nonce) - XCTAssertEqual(tokenRequest1.mac, signed?.mac) + XCTAssertEqual(tokenRequest1.mac, signed.mac) rest.auth.createTokenRequest(tokenParams, options: nil, callback: { tokenRequest, error in XCTAssertNil(error)