Skip to content
Alan Yan edited this page Oct 24, 2019 · 10 revisions

Research on React Native Compatibility with Swift

  • Modules can only be imported one-way

  • Swift modules can be exposed to JavaScript and imported into React Native projects, but React Native modules cannot be incorporated into Swift projects

  • React Native compiles into native Swift, so there is no contract for what the source output code will do, so it is hard to implement with natively written Swift code

Verdict:

  • Since we are not planning to make an Android app as well, it seems that React Native + Swift does not suit our needs as well as a pure Swift iOS application.

Document Setup

  • Currently, we have set up the Swift boilerplate code in an Xcode project

  • The main view controller is a Tab Bar View with two tabs

  • One tab is a Navigation Controller with a nested Tableview and the other one has a simple custom UIView, with a UILabel saying Hello World!

  • The Views folder contains all the code for the setup of each of the physical UI views, with constraints and layout.

  • The Models folder will contain all the code for data structures within the app, if we want to do on-device storage, etc.

  • The Controllers folder contains the View Controllers, the classes that populate the views with data, connecting models to view and doing all the view logic.

Run Steps

  1. To build the project into the simulator, you must download Xcode 11 or newer on a Mac.

  2. To Build and Run, clone the repository, then navigate into iOS -> Food-Doods-Prototype and then click the .xcodeproj.

  3. Once in Xcode, in the top bar, on the left side, there should be a simulation selector next to the run and stop buttons named Food-Doods-Prototype and it is probably set to Generic iOS Device. Change this to iPhone XS or whatever simulation device you want to see the app run on.

  4. Once selected you should be able to click the run button, and it should open the iOS simulator, with a fully interactable simulation of the application.

Clone this wiki locally