The running platform of this project is MAC + iOS
Build the development environment: Xcode, Node, Watchman, Cocoapods
Download Xcode from appstore or our website and make sure that Both Command Line Tools and stimulator are installed
brew install node
brew install watchman
brew install cocoapods
Copy the code
Their respective roles:
- I don’t have to tell you node
- Xcode to get the tools and environment you need to build your iOS app.
- Watchman is a tool provided by Facebook to monitor file system changes. Installing this tool can improve development-time performance (Packager can quickly catch changes to files for real-time refreshes)
- React Native iOS versions require CocoaPods to manage dependencies starting with version 0.60.
Create project: Use the NPX command line to create a project directory called AwesomeProject
npx react-native init AwesomeProject
Copy the code
This step may take a moment here in Installing CocoaPods dependencies (this may take a few minutes)
Compile and run the React Native application
CD AwesomeProject yarn ios # or NPX react-native run-iosCopy the code
This process can also take a while, as it opens the emulator, packages the current RN project and publishes it to the emulator
Just hang on, and after a while, the application is packaged to our emulator.
At this point, open app.js, make any changes, and you’ll see the page refresh automatically.