This guide is for the Macos development environment for React Native iOS app development, for other development environments, please refer to the official React Native documentation for further instruction.
Installing Dependencies
- Have your machine ready for development by installing these dependencies, if they are not presently available on your machine:
- Make sure you have also installed XCode and configured the XCode command line tool properly.
- Install Simulator by going to XCode > Preference > and go to Components tab, and select the simulator you wish to use with the corresponding iOS version.
- Install Cocoapods
Note for Mac M1 users Mac M1 architecture is not directly compatible with Cocoapods. If you encounter issues when installing pods, you can solve it by running: sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
These commands install the ffi package, to load dynamically-linked libraries and let you run the pod install properly, and runs pod install with the proper architecture.
Starting A New Project
- To start a new React Native project, without the Expo dependencies, just run:
- This will create a new folder that contains your new React Native files.
- cd into your project folder.
- Start the development environment with this command:
- The development environment will start
- To kickstart the iOS Simulator, run this command:
- That should boot up the simulator and load your React Native boilerplate app.
- You can now start coding your app.
Hafiz Hanif, PhD
September 15, 2022