You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Connect the classes for C++ Module registration to TMManagerDelegate (facebook#49611)
Summary:
Pull Request resolved: facebook#49611
This Change connects the pod created previously to the `RCTTuboModuleManager` so that it can ask the delegate about the CxxTurboModuleProviders.
We had to introduce a `RCTFullTurboModuleManagerDelegate` that implements both the old `TurboModuleManagerDelegate` and the new Swift compatible one.
## Problem
As of today, it is not possible to create a pure C++ TM and to register it through a Swift AppDelegate
## Solution
We can create a pod that can be imported in a Swift AppDelegate and that offer some pure Objective-C classes.
These classes contains a provider that can be instantiated in Swift.
The TurboModule manager delegate will ask the AppDelegate about the presence of some provider that can instantiate a pure C++ turbomodule with a given name.
The provider has an empty interface, but the implementation contains a function that can actually instantiate the TM. The function is implemented in an Objective-C++ class that imports the pure C++ turbomodule and creates it.
The TMManager extends the provider through a category to attaach the signature of the function that is implemented by the provider.
The last diff in this stack contains an exaple on how to implement this.
## Changelog:
[iOS][Added] - Added the React-SwiftCompatibleNativeModules pod
Reviewed By: javache
Differential Revision: D70012142
fbshipit-source-id: db96c4cd3cdd1062b12f11131b7c6c51ecd74bc7
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.h
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,13 @@
34
34
35
35
@optional
36
36
37
+
/**
38
+
* This method is used to retrieve a factory object that can create a `facebook::react::TurboModule`,
39
+
* The class implementing `RCTTurboModuleProvider` must be an Objective-C class so that we can
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm
0 commit comments