Skip to content

Commit d02c8e4

Browse files
feat(runtime): add nullability annotations to NativeScript.h
Without them every pointer in the embedder API imports into Swift as implicitly unwrapped, which hides the contract the implementation already has: BaseDir, the script string and the Config argument are required (their UTF8String feeds a std::string), while ApplicationPath, MetadataPtr and Arguments are optional with defaults (BaseDir/app, the __TNSMetadata section, no inspector arguments). initWithConfig: never returns nil.
1 parent 686157b commit d02c8e4

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎NativeScript/NativeScript.h‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#import <Foundation/Foundation.h>
22

3+
NS_ASSUME_NONNULL_BEGIN
4+
35
@interface Config : NSObject
46

57
@property (nonatomic, retain) NSString* BaseDir;
6-
@property (nonatomic, retain) NSString* ApplicationPath;
7-
@property (nonatomic) void* MetadataPtr;
8+
@property (nonatomic, retain, nullable) NSString* ApplicationPath;
9+
@property (nonatomic, nullable) void* MetadataPtr;
810
@property BOOL IsDebug;
911
@property BOOL LogToSystemConsole;
1012
@property int ArgumentsCount;
11-
@property (nonatomic) char** Arguments;
13+
@property (nonatomic) char* _Nullable* _Nullable Arguments;
1214

1315
@end
1416

@@ -26,3 +28,5 @@
2628
- (bool)liveSync;
2729

2830
@end
31+
32+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)