SDK Installation
After this guide, your app will be connected to SwiftPatch and ready for OTA updates.
| Dependency | Minimum Version |
|---|---|
| React Native | 0.76.0+ |
| React | 18.2.0+ |
| iOS | 13.4+ |
| Android SDK | 24+ (Android 7.0) |
| Node.js | 18.0.0+ |
You also need a SwiftPatch account with a project created. If you haven't done that yet, follow the Getting Started guide first.
Step 1: Install the Package
npm install @swiftpatch/react-native
See Migrating from CodePush for configuration differences.
Step 2: Find Your App ID
- Open the SwiftPatch Dashboard.
- Go to your project Settings.
- Copy the App ID.
Each project has its own App ID. Separate iOS and Android projects have separate IDs.
Step 3: Configure Native Platforms
iOS
3a. Install CocoaPods:
cd ios && pod install && cd ..
3b. Update your AppDelegate. See iOS Setup for step-by-step instructions.
3c. Add your App ID to ios/YourApp/Info.plist:
<key>SwiftPatchAppId</key>
<string>YOUR_APP_ID</string>
Android
3a. Update your MainApplication. See Android Setup for step-by-step instructions.
3b. Add your App ID to android/app/src/main/res/values/strings.xml:
<string name="SwiftPatchAppId">YOUR_APP_ID</string>
See New Architecture for additional setup.
Step 4: Wrap Your App
import { withSwiftPatch } from '@swiftpatch/react-native';
function App() {
return <YourApp />;
}
export default withSwiftPatch(App);
The SDK handles update checks, downloads, and installation automatically.
Pass a config object to withSwiftPatch for custom behavior. See Configuration.
Step 5: Verify
npx react-native run-ios
# or
npx react-native run-android
Look for this in your logs:
[SwiftPatch] SDK initialized successfully
You're all set!
Check the Troubleshooting guide.
Next Steps
- iOS Setup -- Detailed native config for iOS
- Android Setup -- Detailed native config for Android
- Configuration -- Customize update behavior
- Your First Update -- Ship an OTA update