-
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
Cannot create a library exposing a Turbo Module with Swift code (0.77+) #49104
Comments
Found out the correct settings: You need:
In the podspec file (no Then you need to use generated headers in the .h file:
You can find a working example here if you encounter the same issue: https://github.com/mgcrea/react-native-turbo-module-library-example/tree/swift |
Hello @mgcrea , @cortinico Context: |
I have published a few repository for sample working projects using swift that you can check to help you:
Hopefully that helps! |
Hello @mgcrea I tried using the example from the above repository, but I'm encountering an issue: the file 'generated/NativeLocalStorageSpec/NativeLocalStorageSpec.h' cannot be found. |
You need to run |
@mgcrea , 10 duplicate symbols Here are the steps I am following:
|
Description
I have been trying to find the proper
podspec
configuration to build a "library" that exposes a basic turbo module with a swift implementation, by "library" I mean a module that would end up as a dependency of an RN project.Everything works fine without swift as you can check in the main branch of this repository.
Unfortunately I can't build anymore after adding/using a Swift file. Compiling mixed cpp/swift code seems complicated, and it looks like I'm hitting this issue
However since using a local turbo module setup does work with swift (as long as you revert the AppDelegate to .mm/.h), I guess (hope!) that there is be a
.podspec
config that would build correctly. You can check the working "local" setup in this repositoryI have tried to remove the headers from
s.source_files
as told in this issue but never managed to make it work.Would be great if we had some basic working example for using Swift with RN in these common library-like setups where the package is expected to be added as a dep.
Steps to reproduce
swift
branch of this repository: https://github.com/mgcrea/react-native-turbo-module-library-example/tree/swiftCan't really use the reproducer to easily replicate this "library" setup.
React Native Version
0.77.0
Affected Platforms
Runtime - iOS, Build - MacOS
Areas
TurboModule - The New Native Module System
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/mgcrea/react-native-turbo-module-library-example/tree/swift
Screenshots and Videos
The text was updated successfully, but these errors were encountered: