Search code examples
swiftreact-nativecode-push

Integrating MicroSoft CodePush to Swift Project


I integrated React Native in a swift project. I followed the steps in the following link https://github.com/Microsoft/react-native-code-push#ios-setup to integrate code push to the project.

As there is no Libraries folder in my project, i created one folder and imported CodePush.xcodeproj to that folder.

Since being a swift project, I added the line #import "CodePush.h" to the bridging header file. But when i try to build my project it says 'CodePush.h file not found' error. Any help on this?


Solution

  • I Fixed the issue by following the steps. (Using Pod)

    1. Install Code Push by running the following command in the terminal from the App's root directory.
       npm install --save react-native-code-push
    2. Add the CodePush pod to the Podfile.
       pod 'CodePush', :path => './node_modules/react-native-code-push'
    3. Install the pod.
       pod install 
    4. Add the codepush header file to the BridgingHeader file.
      #import "CodePush.h"
    5. Now you can access CodePush from the swift file.
      CodePush.bundleURL()