Skip to content

Commit c9b501d

Browse files
RSNarafacebook-github-bot
authored andcommitted
ios: Deprecate objc legacy core classes (facebook#53453)
Summary: Pull Request resolved: facebook#53453 Let's deprecate all the classes that aren't used by interop, or the new architecture. Changelog: [iOS][Deprecated] Deprecate all the objc classes not used by interop, or the new architecture. Differential Revision: D80575768 Reviewed By: javache
1 parent 0931202 commit c9b501d

16 files changed

+136
-72
lines changed

packages/react-native/React/Base/RCTBridge+Private.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ RCT_EXTERN void RCTRegisterModule(Class);
2121
- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)delegate
2222
bundleURL:(NSURL *)bundleURL
2323
moduleProvider:(RCTBridgeModuleListProvider)block
24-
launchOptions:(NSDictionary *)launchOptions NS_DESIGNATED_INITIALIZER;
24+
launchOptions:(NSDictionary *)launchOptions NS_DESIGNATED_INITIALIZER
25+
__deprecated_msg("This API will be removed along with the legacy architecture.");
2526

2627
#endif // RCT_FIT_RM_OLD_RUNTIME
2728

@@ -150,7 +151,8 @@ RCT_EXTERN void RCTRegisterModule(Class);
150151
@property (nonatomic, readonly) void *runtime;
151152

152153
#ifndef RCT_FIT_RM_OLD_RUNTIME
153-
- (instancetype)initWithParentBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER;
154+
- (instancetype)initWithParentBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER
155+
__deprecated_msg("This API will be removed along with the legacy architecture.");
154156
#endif // RCT_FIT_RM_OLD_RUNTIME
155157

156158
@end

packages/react-native/React/Base/RCTBridge.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ RCT_EXTERN_C_END
107107
* pre-initialized module instances if they require additional init parameters
108108
* or configuration.
109109
*/
110-
- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)delegate launchOptions:(NSDictionary *)launchOptions;
110+
- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)delegate
111+
launchOptions:(NSDictionary *)launchOptions
112+
__deprecated_msg("This API will be removed along with the legacy architecture.");
111113

112114
/**
113115
* DEPRECATED: Use initWithDelegate:launchOptions: instead
@@ -121,7 +123,8 @@ RCT_EXTERN_C_END
121123
*/
122124
- (instancetype)initWithBundleURL:(NSURL *)bundleURL
123125
moduleProvider:(RCTBridgeModuleListProvider)block
124-
launchOptions:(NSDictionary *)launchOptions;
126+
launchOptions:(NSDictionary *)launchOptions
127+
__deprecated_msg("This API will be removed along with the legacy architecture.");
125128

126129
/**
127130
* This method is used to call functions in the JavaScript application context.

packages/react-native/React/Base/RCTBridgeDelegate.h

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
2121
* When running from a locally bundled JS file, this should be a `file://` url
2222
* pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`.
2323
*/
24-
- (NSURL *__nullable)sourceURLForBridge:(RCTBridge *)bridge;
24+
- (NSURL *__nullable)sourceURLForBridge:(RCTBridge *)bridge
25+
__deprecated_msg("This API will be removed along with the legacy architecture.");
2526

2627
@optional
2728

@@ -39,7 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
3940
* not recommended in most cases - if the module methods and behavior do not
4041
* match exactly, it may lead to bugs or crashes.
4142
*/
42-
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge;
43+
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
44+
__deprecated_msg("This API will be removed along with the legacy architecture.");
4345

4446
/**
4547
* The bridge will call this method when a module been called from JS
@@ -48,7 +50,9 @@ NS_ASSUME_NONNULL_BEGIN
4850
* in the implementation, and the system must attempt to look for it again among registered.
4951
* If the module was not registered, return NO to prevent further searches.
5052
*/
51-
- (BOOL)bridge:(RCTBridge *)bridge didNotFindModule:(NSString *)moduleName;
53+
- (BOOL)bridge:(RCTBridge *)bridge
54+
didNotFindModule:(NSString *)moduleName
55+
__deprecated_msg("This API will be removed along with the legacy architecture.");
5256

5357
/**
5458
* The bridge will automatically attempt to load the JS source code from the
@@ -57,18 +61,22 @@ NS_ASSUME_NONNULL_BEGIN
5761
*/
5862
- (void)loadSourceForBridge:(RCTBridge *)bridge
5963
onProgress:(RCTSourceLoadProgressBlock)onProgress
60-
onComplete:(RCTSourceLoadBlock)loadCallback;
64+
onComplete:(RCTSourceLoadBlock)loadCallback
65+
__deprecated_msg("This API will be removed along with the legacy architecture.");
6166

6267
/**
6368
* Similar to loadSourceForBridge:onProgress:onComplete: but without progress
6469
* reporting.
6570
*/
66-
- (void)loadSourceForBridge:(RCTBridge *)bridge withBlock:(RCTSourceLoadBlock)loadCallback;
71+
- (void)loadSourceForBridge:(RCTBridge *)bridge
72+
withBlock:(RCTSourceLoadBlock)loadCallback
73+
__deprecated_msg("This API will be removed along with the legacy architecture.");
6774

6875
/**
6976
* Retrieve the list of lazy-native-modules names for the given bridge.
7077
*/
71-
- (NSDictionary<NSString *, Class> *)extraLazyModuleClassesForBridge:(RCTBridge *)bridge;
78+
- (NSDictionary<NSString *, Class> *)extraLazyModuleClassesForBridge:(RCTBridge *)bridge
79+
__deprecated_msg("This API will be removed along with the legacy architecture.");
7280

7381
#endif // RCT_FIT_RM_OLD_RUNTIME
7482
@end

packages/react-native/React/Base/RCTJavaScriptExecutor.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@
1010
#import <React/RCTBridgeModule.h>
1111
#import <React/RCTInvalidating.h>
1212

13-
typedef void (^RCTJavaScriptCompleteBlock)(NSError *error);
14-
typedef void (^RCTJavaScriptCallback)(id result, NSError *error);
13+
typedef void (^RCTJavaScriptCompleteBlock)(NSError *error)
14+
__deprecated_msg("This api will be removed along with the bridge.");
15+
typedef void (^RCTJavaScriptCallback)(id result, NSError *error)
16+
__deprecated_msg("This api will be removed along with the bridge.");
1517

1618
#ifndef RCT_FIT_RM_OLD_RUNTIME
1719
/**
1820
* Abstracts away a JavaScript execution context - we may be running code in a
1921
* web view (for debugging purposes), or may be running code in a `JSContext`.
2022
*/
21-
@protocol RCTJavaScriptExecutor <RCTInvalidating, RCTBridgeModule>
23+
__deprecated_msg("This api will be removed along with the bridge.")
24+
@protocol RCTJavaScriptExecutor<RCTInvalidating, RCTBridgeModule>
2225

2326
/**
2427
* Used to set up the executor after the bridge has been fully initialized.

packages/react-native/React/Base/RCTModuleData.h

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,76 +34,90 @@ typedef id<RCTBridgeModule> (^RCTBridgeModuleProvider)(void);
3434
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
3535
viewRegistry_DEPRECATED:(RCTViewRegistry *)viewRegistry_DEPRECATED
3636
bundleManager:(RCTBundleManager *)bundleManager
37-
callableJSModules:(RCTCallableJSModules *)callableJSModules NS_DESIGNATED_INITIALIZER;
37+
callableJSModules:(RCTCallableJSModules *)callableJSModules NS_DESIGNATED_INITIALIZER
38+
__deprecated_msg("This API will be removed along with the legacy architecture.");
3839

3940
- (instancetype)initWithModuleInstance:(id<RCTBridgeModule>)instance
4041
bridge:(RCTBridge *)bridge
4142
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
4243
viewRegistry_DEPRECATED:(RCTViewRegistry *)viewRegistry_DEPRECATED
4344
bundleManager:(RCTBundleManager *)bundleManager
44-
callableJSModules:(RCTCallableJSModules *)callableJSModules NS_DESIGNATED_INITIALIZER;
45+
callableJSModules:(RCTCallableJSModules *)callableJSModules NS_DESIGNATED_INITIALIZER
46+
__deprecated_msg("This API will be removed along with the legacy architecture.");
4547

4648
/**
4749
* Calls `constantsToExport` on the module and stores the result. Note that
4850
* this will init the module if it has not already been created. This method
4951
* can be called on any thread, but may block the main thread briefly if the
5052
* module implements `constantsToExport`.
5153
*/
52-
- (void)gatherConstants;
54+
- (void)gatherConstants __deprecated_msg("This API will be removed along with the legacy architecture.");
5355

54-
@property (nonatomic, strong, readonly) Class moduleClass;
55-
@property (nonatomic, copy, readonly) NSString *name;
56+
@property (nonatomic, strong, readonly)
57+
Class moduleClass __deprecated_msg("This API will be removed along with the legacy architecture.");
58+
@property (nonatomic, copy, readonly)
59+
NSString *name __deprecated_msg("This API will be removed along with the legacy architecture.");
5660

5761
/**
5862
* Returns the module methods. Note that this will gather the methods the first
5963
* time it is called and then memoize the results.
6064
*/
61-
@property (nonatomic, copy, readonly) NSArray<id<RCTBridgeMethod>> *methods;
65+
@property (nonatomic, copy, readonly) NSArray<id<RCTBridgeMethod>> *methods __deprecated_msg(
66+
"This API will be removed along with the legacy architecture.");
6267

6368
/**
6469
* Returns a map of the module methods. Note that this will gather the methods the first
6570
* time it is called and then memoize the results.
6671
*/
67-
@property (nonatomic, copy, readonly) NSDictionary<NSString *, id<RCTBridgeMethod>> *methodsByName;
72+
@property (nonatomic, copy, readonly) NSDictionary<NSString *, id<RCTBridgeMethod>> *methodsByName __deprecated_msg(
73+
"This API will be removed along with the legacy architecture.");
6874

6975
/**
7076
* Returns the module's constants, if it exports any
7177
*/
72-
@property (nonatomic, copy, readonly) NSDictionary<NSString *, id> *exportedConstants;
78+
@property (nonatomic, copy, readonly) NSDictionary<NSString *, id> *exportedConstants __deprecated_msg(
79+
"This API will be removed along with the legacy architecture.");
7380

7481
/**
7582
* Returns YES if module instance has already been initialized; NO otherwise.
7683
*/
77-
@property (nonatomic, assign, readonly) BOOL hasInstance;
84+
@property (nonatomic, assign, readonly)
85+
BOOL hasInstance __deprecated_msg("This API will be removed along with the legacy architecture.");
7886

7987
/**
8088
* Returns YES if module instance must be created on the main thread.
8189
*/
82-
@property (nonatomic, assign) BOOL requiresMainQueueSetup;
90+
@property (nonatomic, assign)
91+
BOOL requiresMainQueueSetup __deprecated_msg("This API will be removed along with the legacy architecture.");
8392

8493
/**
8594
* Returns YES if module has constants to export.
8695
*/
87-
@property (nonatomic, assign, readonly) BOOL hasConstantsToExport;
96+
@property (nonatomic, assign, readonly)
97+
BOOL hasConstantsToExport __deprecated_msg("This API will be removed along with the legacy architecture.");
8898

8999
/**
90100
* Returns the current module instance. Note that this will init the instance
91101
* if it has not already been created. To check if the module instance exists
92102
* without causing it to be created, use `hasInstance` instead.
93103
*/
94-
@property (nonatomic, strong, readwrite) id<RCTBridgeModule> instance;
104+
@property (nonatomic, strong, readwrite) id<RCTBridgeModule> instance __deprecated_msg(
105+
"This API will be removed along with the legacy architecture.");
95106

96107
/**
97108
* Returns the module method dispatch queue. Note that this will init both the
98109
* queue and the module itself if they have not already been created.
99110
*/
100-
@property (nonatomic, strong, readonly) dispatch_queue_t methodQueue;
111+
@property (nonatomic, strong, readonly)
112+
dispatch_queue_t methodQueue __deprecated_msg("This API will be removed along with the legacy architecture.");
101113

102114
/**
103115
* Whether the receiver has a valid `instance` which implements -batchDidComplete.
104116
*/
105-
@property (nonatomic, assign, readonly) BOOL implementsBatchDidComplete;
117+
@property (nonatomic, assign, readonly)
118+
BOOL implementsBatchDidComplete __deprecated_msg("This API will be removed along with the legacy architecture.");
106119

107-
@property (nonatomic, weak, readwrite) id<RCTModuleDataCallInvokerProvider> callInvokerProvider;
120+
@property (nonatomic, weak, readwrite) id<RCTModuleDataCallInvokerProvider> callInvokerProvider __deprecated_msg(
121+
"This API will be removed along with the legacy architecture.");
108122

109123
@end

packages/react-native/React/Base/RCTRootContentView.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,25 @@
1818

1919
@interface RCTRootContentView : RCTView <RCTInvalidating>
2020

21-
@property (nonatomic, readonly, weak) RCTBridge *bridge;
22-
@property (nonatomic, readonly, assign) BOOL contentHasAppeared;
23-
@property (nonatomic, readonly, strong) RCTTouchHandler *touchHandler;
24-
@property (nonatomic, readonly, assign) CGSize availableSize;
25-
26-
@property (nonatomic, assign) BOOL passThroughTouches;
27-
@property (nonatomic, assign) RCTRootViewSizeFlexibility sizeFlexibility;
21+
@property (nonatomic, readonly, weak)
22+
RCTBridge *bridge __deprecated_msg("This API will be removed along with the legacy architecture.");
23+
@property (nonatomic, readonly, assign)
24+
BOOL contentHasAppeared __deprecated_msg("This API will be removed along with the legacy architecture.");
25+
@property (nonatomic, readonly, strong)
26+
RCTTouchHandler *touchHandler __deprecated_msg("This API will be removed along with the legacy architecture.");
27+
@property (nonatomic, readonly, assign)
28+
CGSize availableSize __deprecated_msg("This API will be removed along with the legacy architecture.");
29+
30+
@property (nonatomic, assign)
31+
BOOL passThroughTouches __deprecated_msg("This API will be removed along with the legacy architecture.");
32+
@property (nonatomic, assign) RCTRootViewSizeFlexibility sizeFlexibility __deprecated_msg(
33+
"This API will be removed along with the legacy architecture.");
2834

2935
- (instancetype)initWithFrame:(CGRect)frame
3036
bridge:(RCTBridge *)bridge
3137
reactTag:(NSNumber *)reactTag
32-
sizeFlexibility:(RCTRootViewSizeFlexibility)sizeFlexibility NS_DESIGNATED_INITIALIZER;
38+
sizeFlexibility:(RCTRootViewSizeFlexibility)sizeFlexibility NS_DESIGNATED_INITIALIZER
39+
__deprecated_msg("This API will be removed along with the legacy architecture.");
3340

3441
@end
3542

packages/react-native/React/Base/RCTRootView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extern
4747
* like any ordinary UIView. You can have multiple RCTRootViews on screen at
4848
* once, all controlled by the same JavaScript application.
4949
*/
50-
@interface RCTRootView : UIView
50+
__deprecated_msg("This API will be removed along with the legacy architecture.") @interface RCTRootView : UIView
5151

5252
/**
5353
* - Designated initializer -

packages/react-native/React/Base/RCTRootViewInternal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* The interface provides a set of functions that allow other internal framework
1414
* classes to change the RCTRootViews's internal state.
1515
*/
16-
@interface RCTRootView ()
16+
__deprecated_msg("This API will be removed along with the legacy architecture.") @interface RCTRootView()
1717

1818
/**
1919
* This setter should be used only by RCTUIManager on react root view

packages/react-native/React/Base/Surface/RCTSurface.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ NS_ASSUME_NONNULL_BEGIN
3232
* * ability to create a UIView instance on demand (later);
3333
* * ability to communicate the current stage of the surface granularly.
3434
*/
35-
@interface RCTSurface : NSObject <RCTSurfaceProtocol>
35+
__deprecated_msg("This API will be removed along with the legacy architecture.") @interface RCTSurface
36+
: NSObject<RCTSurfaceProtocol>
3637

3738
- (instancetype)initWithBridge:(RCTBridge *)bridge
3839
moduleName:(NSString *)moduleName

packages/react-native/React/Base/Surface/RCTSurfaceRootShadowView.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#import <React/RCTSurfaceRootShadowViewDelegate.h>
1010
#import <yoga/YGEnums.h>
1111

12-
@interface RCTSurfaceRootShadowView : RCTShadowView
12+
__deprecated_msg("This API will be removed along with the legacy architecture.") @interface RCTSurfaceRootShadowView
13+
: RCTShadowView
1314

1415
@property (nonatomic, assign, readonly) CGSize minimumSize;
1516
@property (nonatomic, assign, readonly) CGSize maximumSize;
@@ -18,7 +19,8 @@
1819

1920
@property (nonatomic, assign, readonly) CGSize intrinsicSize;
2021

21-
@property (nonatomic, weak) id<RCTSurfaceRootShadowViewDelegate> delegate;
22+
@property (nonatomic, weak) id<RCTSurfaceRootShadowViewDelegate> delegate __deprecated_msg(
23+
"This API will be removed along with the legacy architecture.");
2224

2325
/**
2426
* Layout direction (LTR or RTL) inherited from native environment and

0 commit comments

Comments
 (0)