From b23fcbeb747682eedd77d61117d72072575015d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Kwas=CC=81niewski?= Date: Wed, 10 Jan 2024 16:36:52 +0100 Subject: [PATCH] Use Objective-C nullability to provide better Swift types --- .../Libraries/AppDelegate/RCTAppDelegate.h | 12 ++++++++---- packages/react-native/React/Base/RCTBridgeDelegate.h | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h index 2c8ce3fa3636..4c89afce6d78 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h @@ -14,6 +14,8 @@ @class RCTRootView; @class RCTSurfacePresenterBridgeAdapter; +NS_ASSUME_NONNULL_BEGIN + /** * The RCTAppDelegate is an utility class that implements some base configurations for all the React Native apps. * It is not mandatory to use it, but it could simplify your AppDelegate code. @@ -55,10 +57,10 @@ @interface RCTAppDelegate : UIResponder /// The window object, used to render the UViewControllers -@property (nonatomic, strong) UIWindow *window; -@property (nonatomic, strong) RCTBridge *bridge; -@property (nonatomic, strong) NSString *moduleName; -@property (nonatomic, strong) NSDictionary *initialProps; +@property (nonatomic, strong, nonnull) UIWindow *window; +@property (nonatomic, strong, nullable) RCTBridge *bridge; +@property (nonatomic, strong, nullable) NSString *moduleName; +@property (nonatomic, strong, nullable) NSDictionary *initialProps; /** * It creates a `RCTBridge` using a delegate and some launch options. @@ -160,3 +162,5 @@ - (NSURL *)bundleURL; @end + +NS_ASSUME_NONNULL_END diff --git a/packages/react-native/React/Base/RCTBridgeDelegate.h b/packages/react-native/React/Base/RCTBridgeDelegate.h index 0e081964bc2e..0d9ec0a2b137 100644 --- a/packages/react-native/React/Base/RCTBridgeDelegate.h +++ b/packages/react-native/React/Base/RCTBridgeDelegate.h @@ -10,6 +10,8 @@ @class RCTBridge; @protocol RCTBridgeModule; +NS_ASSUME_NONNULL_BEGIN + @protocol RCTBridgeDelegate /** @@ -77,3 +79,5 @@ - (NSDictionary *)extraLazyModuleClassesForBridge:(RCTBridge *)bridge; @end + +NS_ASSUME_NONNULL_END