Skip to content

Commit dd70742

Browse files
Add NS_ASSUME_NONNULL to all headers and .m @interface declarations
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 <noreply@anthropic.com>
1 parent 8570f03 commit dd70742

34 files changed

Lines changed: 153 additions & 31 deletions

Source/ARTChannels.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
#import "ARTRestChannel.h"
77
#import "ARTGCD.h"
88

9+
NS_ASSUME_NONNULL_BEGIN
10+
911
@interface ARTChannels() {
1012
__weak id<ARTChannelsDelegate> _delegate; // weak because delegates outlive their counterpart
1113
dispatch_queue_t _queue;
1214
}
1315

1416
@end
1517

18+
NS_ASSUME_NONNULL_END
19+
1620
@implementation ARTChannels
1721

1822
- (instancetype)initWithDelegate:(id)delegate dispatchQueue:(dispatch_queue_t)queue prefix:(NSString *)prefix {

Source/ARTClientOptions.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
NSString *ARTDefaultEnvironment = nil;
2020

21+
NS_ASSUME_NONNULL_BEGIN
22+
2123
@interface ARTClientOptions ()
2224

2325
@property (nonatomic) NSMutableDictionary<NSString *, id> *pluginData;
@@ -26,6 +28,8 @@ - (instancetype)initDefaults;
2628

2729
@end
2830

31+
NS_ASSUME_NONNULL_END
32+
2933
@implementation ARTClientOptions
3034

3135
- (instancetype)initDefaults {

Source/ARTContinuousClock.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#import "ARTContinuousClock.h"
22

3+
NS_ASSUME_NONNULL_BEGIN
4+
35
@interface ARTContinuousClockInstant ()
46

57
- (instancetype)initWithTime:(uint64_t)time NS_DESIGNATED_INITIALIZER;
@@ -13,6 +15,8 @@ - (instancetype)initWithTime:(uint64_t)time NS_DESIGNATED_INITIALIZER;
1315

1416
@end
1517

18+
NS_ASSUME_NONNULL_END
19+
1620
@implementation ARTContinuousClock
1721

1822
- (ARTContinuousClockInstant *)now {

Source/ARTCrypto.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#define ART_CBC_BLOCK_LENGTH (16)
77

8+
NS_ASSUME_NONNULL_BEGIN
9+
810
@interface ARTCipherParams ()
911

1012
- (BOOL)ccAlgorithm:(CCAlgorithm *)algorithm error:(NSError **)error;
@@ -17,6 +19,8 @@ @interface ARTCbcCipher ()
1719

1820
@end
1921

22+
NS_ASSUME_NONNULL_END
23+
2024
@implementation NSString (ARTCipherKeyCompatible)
2125

2226
- (NSData *)toData {

Source/ARTEventEmitter.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,16 @@ - (NSString *)identification {
4646

4747
#pragma mark - ARTEventListener
4848

49+
NS_ASSUME_NONNULL_BEGIN
50+
4951
@interface ARTEventListener ()
5052
@property (readonly) BOOL invalidated;
5153
@property (readonly) BOOL timerIsRunning;
5254
@property (readonly) BOOL hasTimer;
5355
@end
5456

57+
NS_ASSUME_NONNULL_END
58+
5559
@implementation ARTEventListener {
5660
NSNotificationCenter *_center;
5761
__weak ARTEventEmitter *_eventHandler; // weak because eventEmitter owns self

Source/ARTFallback.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
}
1111
};
1212

13+
NS_ASSUME_NONNULL_BEGIN
14+
1315
@interface ARTFallback ()
1416

1517
@end
1618

19+
NS_ASSUME_NONNULL_END
20+
1721
@implementation ARTFallback
1822

1923
- (instancetype)initWithFallbackHosts:(nullable NSArray<NSString *> *)fallbackHosts shuffleArray:(void (^)(NSMutableArray *))shuffleArray {

Source/ARTGCD.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
#import "ARTGCD.h"
22

3+
NS_ASSUME_NONNULL_BEGIN
4+
35
@interface ARTScheduledBlockHandle ()
46

57
// Mark this as `atomic` to syncronize access to it from `_scheduledBlock` and `cancel`.
68
@property (atomic, copy, nullable) dispatch_block_t block;
79

810
@end
911

12+
NS_ASSUME_NONNULL_END
13+
1014
@implementation ARTScheduledBlockHandle {
1115
dispatch_block_t _scheduledBlock;
1216
}

Source/ARTHttp.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
#import "ARTConstants.h"
44
#import "ARTInternalLog.h"
55

6+
NS_ASSUME_NONNULL_BEGIN
7+
68
@interface ARTHttp ()
79

810
@property (readonly, nonatomic) id<ARTURLSession> urlSession;
911

1012
@end
1113

14+
NS_ASSUME_NONNULL_END
15+
1216
Class configuredUrlSessionClass = nil;
1317

1418
#pragma mark - ARTHttp

Source/ARTLocalDevice.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@
4040
return [ARTAPNSDeviceTokenKey stringByAppendingFormat:@"-%@", tokenType ?: ARTAPNSDeviceDefaultTokenType];
4141
}
4242

43+
NS_ASSUME_NONNULL_BEGIN
44+
4345
@interface ARTLocalDevice ()
4446

4547
@property (nullable, nonatomic, readonly) ARTInternalLog *logger;
4648

4749
@end
4850

51+
NS_ASSUME_NONNULL_END
52+
4953
@implementation ARTLocalDevice
5054

5155
- (instancetype)initWithStorage:(id<ARTDeviceStorage>)storage logger:(nullable ARTInternalLog *)logger {

Source/ARTRealtime.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,16 @@
5757
#import "ARTWrapperSDKProxyRealtime+Private.h"
5858
#import "ARTConnectionDetails+Private.h"
5959

60+
NS_ASSUME_NONNULL_BEGIN
61+
6062
@interface ARTConnectionStateChange ()
6163

6264
- (void)setRetryIn:(NSTimeInterval)retryIn;
6365

6466
@end
6567

68+
NS_ASSUME_NONNULL_END
69+
6670
#pragma mark - ARTRealtime implementation
6771

6872
@implementation ARTRealtime {

0 commit comments

Comments
 (0)