Reputation: 31
I tried to follow the instruction on here: https://gist.github.com/boopathi/27d21956fefcb5b168fe
The instruction is somewhat dated with respect to how fast new react-native builds are pushed.
I fixed some of the obvious issues in the instruction (change lib.ReactKit.a to libReact.a, etc...).
I was able to compile the swift project and bring up the simulator. However, the red screen of death showed up with the following msg: Unable to execute JS call: __fbBatchedBridge is undefined
Any insights or general direction to how to create a swift project with react-native would be appreciated.
Upvotes: 2
Views: 540
Reputation: 31
After looking through multiple ways of creating a swift project, the following method worked for me:
1) Follow the instruction here (use the swift version): https://github.com/davidyaha/react-native/blob/master/docs/EmbeddedAppIOS.md
2) If your build ran into a red screen of death with "Could not connect to development server". Paste the following lines into your Info.plist file under your swift project:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
Detailed discussion of the reasoning is here https://github.com/facebook/react-native/issues/304
The above steps will allow you to see the react-native component in a swift project.
Upvotes: 1