# IOS Setup

## **Ios Setup:**

1. **Prerequisites**\
   \
   **Mac Computer:** iOS development requires macOS.\
   **Xcode:** Install the latest version of Xcode from the Mac App Store.\
   **CocoaPods:** Install CocoaPods (dependency manager for iOS) using:<br>

   ```html
   sudo gem install cocoapods
   ```

   \
   **Node.js and npm/yarn:** Ensure Node.js is installed on your system.\
   **React Native CLI:** If you're using the CLI (not Expo), ensure it's installed globally.\ <br>

2. **Create or Open Your React Native Project**

   * If you haven't already created a project, do so with:<br>

     ```html
     npx react-native init MyProject
     ```

     <i class="fa-files-o">:files-o:</i>
   * Navigate to your project directory:

   ```html
   cd MyProject
   ```

3. **Install Dependencies**<br>
   * Navigate to the ios folder:<br>

     ```html
     cd ios
     ```

     <i class="fa-files-o">:files-o:</i>

   * Install CocoaPods dependencies:<br>

     ```html
     pod install
     ```

   * Return to the root directory:

     ```html
     cd ..
     ```

4. **Open the Project in Xcode**<br>
   * Open the .xcworkspace file located in the ios folder:<br>

     ```html
     open ios/MyProject.xcworkspace
     ```

   * Set your Development Team:\
     \
     In Xcode, go to the Signing & Capabilities tab of your target (usually the project name).     \
     Choose a development team (you may need an Apple Developer account).<br>

5. **Configure the App**\
   \
   **App Icons and Launch Screen:**&#x41;dd your app's icons and splash screen in ios/MyProject/Images.xcassets.\
   **Permissions:**&#x55;pdate Info.plist to request necessary permissions. For example, for camera usage:<br>

   ```html
   This app requires access to the camera.
   ```

6. **Run the App on a Simulator**<br>

   * Start the Metro bundler:<br>

     ```html
     npx react-native start
     ```

   * Run the app:<br>

     ```html
     npx react-native run-ios
     ```

     \
     \
     Alternatively, you can run the app directly from Xcode:\
     &#x20; **1.**  Select a simulator (e.g., iPhone 14).     \
     &#x20; 2\. Press the Run button (⏵).

7. **Run on a Physical Device (Optional)**<br>
   * Connect your iOS device to your Mac via USB.
   * Ensure the device is trusted by your Mac (approve the prompt on the device).
   * Select your device in Xcode as the build target.
   * Press the Run button (⏵).
   * <mark style="color:$warning;">**Note:To run on a physical device, you need to have a valid Apple Developer account and provisioning profile.**</mark><br>

8. **Debugging**<br>
   * Use Metro for debugging and live reloading.
   * In the app, shake the device or press **Cmd+D** (Simulator) to open the Developer Menu.
   * Select Enable **Fast Refresh** for live updates.<br>

9. **Testing Release Builds**<br>
   * Create a release build in Xcode by selecting **Product > Archive**.
   * Test on a physical device or distribute via TestFlight.
