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

[Swift] Incomplete documentation for exporting custom Swift module? #1468

Closed
kevindeleon opened this Issue May 31, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@kevindeleon
Copy link
Contributor

kevindeleon commented May 31, 2015

I was working on creating a custom module using swift based on a tutorial by Jay Garcia. I've got everything working, but one thing I did run into that doesn't seem to be in the documentation is the need for an objective-c bridging file (see in my github repo the following file) that contains an import for RCTBridgeModule.h. Without that bridging header file, I receive an error on build that Xcode can't find the bridging header file, and without the import statement in that file, I receive a build error saying that I'm trying to use an undeclared type (RCTResponseSenderBlock).

I'm not a Swift guru, so I'm not sure if that is something I should have just known and has been left out for that reason, an error on my part or if it's a piece of the documentation that is missing. If it's missing documentation, I can try to write something up for it, but not being a Swift expert, I'd definitely need someone to review it.

@olivierlesnicki

This comment has been minimized.

Copy link

olivierlesnicki commented Jun 7, 2015

@kevindeleon whenever you mix objective c and swift you need a bridging file. This is standard practice however you're right that they should add a line in the doc

@olivierlesnicki

This comment has been minimized.

Copy link

olivierlesnicki commented Jun 7, 2015

@kevindeleon did you manage to implement a native UI widget using Swift? as per https://facebook.github.io/react-native/docs/nativecomponentsios.html#content

@kevindeleon

This comment has been minimized.

Copy link
Contributor

kevindeleon commented Jun 7, 2015

@olivierlesnicki No, it was a native module using Swift. I basically ported over a module Jay Garcia had created as a proof of concept in Objective C...I just wanted to see how difficult it would be in Swift. You can read more about the process or view the code on github.

And if it's a common practice that most Swift developers would just know, then maybe it doesn't need a line in the documentation. I'd like a few more opinions before I close it. As a web guy coming over to the Swift/ObjC world...it was a bit confusing, and I assume most folks using RN will have the same background as I do (web guys coming over to the "native" world).

@kevindeleon

This comment has been minimized.

Copy link
Contributor

kevindeleon commented Jun 7, 2015

@olivierlesnicki I went ahead and created a pull request with some proposed documentation changes. I'll let the team decide if it's worthwhile.

@brentvatne

This comment has been minimized.

Copy link
Collaborator

brentvatne commented Jun 7, 2015

Closed with #1548 😄

@brentvatne brentvatne closed this Jun 7, 2015

@facebook facebook locked as resolved and limited conversation to collaborators Jun 7, 2018

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