Add support for exporting Swift modules #982

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
7 participants
@robertjpayne
Contributor

robertjpayne commented Apr 23, 2015

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.

Add EXTERN macros for exporting external modules
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

This comment has been minimized.

Show comment
Hide comment
@robertjpayne

robertjpayne Apr 23, 2015

Contributor

@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?

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@nicklockwood

nicklockwood Apr 23, 2015

Contributor

@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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@robertjpayne

robertjpayne Apr 23, 2015

Contributor

@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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@vjeux

vjeux Apr 25, 2015

Contributor

Awesome! Would be nice to update the documentation to explain how to use it :)

http://facebook.github.io/react-native/docs/nativemodulesios.html#content

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@robertjpayne

robertjpayne Apr 26, 2015

Contributor

@vjeux ok, I'll get the docs going for NativeModules, I missed getting Native UI Components via Swift support which would be awesome too.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@robertjpayne

robertjpayne Apr 26, 2015

Contributor

@vjeux documentation added via #1021. It's brief but gets it done and the Objective-C documentation is still very relevant.

Contributor

robertjpayne commented Apr 26, 2015

@vjeux documentation added via #1021. It's brief but gets it done and the Objective-C documentation is still very relevant.

@kristianmandrup

This comment has been minimized.

Show comment
Hide comment
@kristianmandrup

kristianmandrup Mar 30, 2016

Most of the RN docs still seem very old school, using Objective C and ES5 syntax for most examples...
I couldn't find a Swift example in the official docs.

Most of the RN docs still seem very old school, using Objective C and ES5 syntax for most examples...
I couldn't find a Swift example in the official docs.

@tirrorex

This comment has been minimized.

Show comment
Hide comment
@tirrorex

tirrorex Nov 3, 2017

It's been a year and a half and things haven't changed documentation side, that's a bummer.

tirrorex commented Nov 3, 2017

It's been a year and a half and things haven't changed documentation side, that's a bummer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment