Search code examples
iosxcodereact-nativeideworkflow

React Native newbie. Using XCode for the native iOS part in /iOS. What do I use for javascript in root folder? What's a best-practice workflow?


Confused as any newbie would be!

I am a React Native newbie. Following a tutorial I created a project. I can use XCode to open the native iOS project in /iOS. What do I use for the javascript files in the root folder? Should I use a second editor for js - i.e. one of the standard js editors (Atom, vi etc). What is the best-practice workflow? Or can I accomplish everything with one editor. Advice, recommendations would be most appreciated.

CLARIFICATIOINS: To clarify my question, take the following sample project:

I want to write a react native app which opens to a table view i.e. list screen with multiple items in a list screen. When you pick one item in the list the app navigates to a details screen. Suppose the list screen is React Native and the details screen is Native iOS. I can code up the list screen using VSCode in React Native js. And then I can code the native details screen in XCode. So for the native part I can open XCode and create a fresh project. What kind of project should this be? Should it be an IOS App or am IOS framework/library? Perhaps a main app as the AppDelegate and a test harness, and a framework/library for the one View Controller screen I will need to import into my React Native project? And then how do I run this to test and debug it out end to end in the simulator? I can possibly correct and live reload the React native portion, but suppose I want to update the iOS portion, what step do I need to go back to? etc.


Solution

  • It's not very common to do your coding work directly inside XCode. XCode is more of a place to organize your project/environment/builds/signing etc... Instead you should be writing all of your code inside the editor of your choice. The standard workflow would be:

    • Create project on command line
    • Use your editor of choice for coding. I use VSCode.
    • in your editor, open your project folder that you just created
    • use XCode for running the ios emulator and super specific iOS tasks
    • All Android specific work can easily be done in VSCode (you don't ever actually need to use Android Studio)