Uh oh!
There was an error while loading. Please reload this page.
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.
robertjpayne
commented
Apr 23, 2015
@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? |
nicklockwood
commented
Apr 23, 2015
@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. |
robertjpayne
commented
Apr 23, 2015
@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. |
vjeux
commented
Apr 25, 2015
Awesome! Would be nice to update the documentation to explain how to use it :) http://facebook.github.io/react-native/docs/nativemodulesios.html#content |
robertjpayne
commented
Apr 26, 2015
@vjeux ok, I'll get the docs going for NativeModules, I missed getting Native UI Components via Swift support which would be awesome too. |
robertjpayne
commented
Apr 26, 2015
kristianmandrup
commented
Mar 30, 2016
Most of the RN docs still seem very old school, using Objective C and ES5 syntax for most examples... |
tirrorex
commented
Nov 3, 2017
It's been a year and a half and things haven't changed documentation side, that's a bummer. |
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.