-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Add support for exporting Swift modules #982
Add support for exporting Swift modules #982
Conversation
External modules are any Objective-C class in which the implementation is private. This currently will be most useful for Swift classes but also has potential to allow exposing methods on 3rd party libraries to the bridge.
@nicklockwood in reference to #207. I was adding some tests but can't add Swift files to the project because it's a static lib. Any recommendations on how to best write tests? Maybe just an external Objective-C module? |
@robertjpayne I have some work to do in order to support this. Because of the data segment registration mechanism, right now, even if you pass a module in explicitly via the moduleProvider block, it won't work if the class is defined outside the main binary because it can't pick up the metadata. That's why the RCTTest module must be included in the app target right now instead of just the test target. Shouldn't be too hard to fix this though. |
@nicklockwood yeah, I managed to kind of hack a small test together with Objective-C but it does't really validate much other than the fact the small macro works. Testing Swift integration is much more key as it's way more likely to break. Let me know if I can help with anything else. |
Awesome! Would be nice to update the documentation to explain how to use it :) http://facebook.github.io/react-native/docs/nativemodulesios.html#content |
@vjeux ok, I'll get the docs going for NativeModules, I missed getting Native UI Components via Swift support which would be awesome too. |
Most of the RN docs still seem very old school, using Objective C and ES5 syntax for most examples... |
It's been a year and a half and things haven't changed documentation side, that's a bummer. |
update ActivityIndicator.md
External modules are any Objective-C class in which the implementation is private. This currently will be most useful for Swift classes but also has potential to allow exposing methods on 3rd party libraries to the bridge.