-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connect the classes for C++ Module registration to TMManagerDelegate #49611
Open
cipolleschi
wants to merge
2
commits into
facebook:main
Choose a base branch
from
cipolleschi:export-D70012142
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Summary: This Change introduces a new pod that can be imported by a Swift App Delegate. This pod contains basic classes that allow the creation of pure C++ TM (with a very smal bridge of Objective-C++) that can be registered in a Swift App delegate. ## 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 Differential Revision: D69999280
This pull request was exported from Phabricator. Differential Revision: D70012142 |
cipolleschi
added a commit
to cipolleschi/react-native
that referenced
this pull request
Feb 22, 2025
…acebook#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 Differential Revision: D70012142
…acebook#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 Differential Revision: D70012142
This pull request was exported from Phabricator. Differential Revision: D70012142 |
ea03af6
to
6d040b6
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
p: Facebook
Partner: Facebook
Partner
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
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 oldTurboModuleManagerDelegate
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
Differential Revision: D70012142