SDK Overview
The SwiftPatch SDK pushes over-the-air updates to your React Native app -- no app store review required. Install it, wrap your root component, and deploy from the CLI. Your users get changes in seconds.
An OTA update replaces your app's JavaScript bundle at runtime. Native code changes still require an app store release. The SDK handles downloading, verifying, and applying bundle updates automatically.
Get Started in 3 Steps
Step 1: Install
npm install @swiftpatch/react-native
Step 2: Wrap Your Root Component
import { withSwiftPatch } from '@swiftpatch/react-native';
function App() {
return <YourApp />;
}
export default withSwiftPatch(App);
Step 3: Deploy
swiftpatch deploy -p ios --hermes
That's it! Your app now checks for updates on every launch and resume, downloads them in the background, and applies them on the next restart.
The SDK reads credentials from native config files. You do not need to pass options to withSwiftPatch unless you want to customize behavior.
How It Works
┌─────────────────────┐ ┌──────────────────────┐
│ Your React Native │ │ SwiftPatch API │
│ App │────────>│ api.swiftpatch.io │
│ │ check │ │
│ ┌───────────────┐ │ └──────────────────────┘
│ │ SwiftPatch SDK│ │ │
│ │ │ │ │ manifest
│ │ - Check │ │ v
│ │ - Download │ │ ┌──────────────────────┐
│ │ - Verify │<─────────│ SwiftPatch CDN │
│ │ - Install │ │ bundle │ cdn.swiftpatch.io │
│ │ - Stabilize │ │ └──────────────────────┘
│ └───────────────┘ │
└─────────────────────┘
Update Lifecycle
- Check -- Query the API on launch and resume for new deployments.
- Download -- Fetch the bundle from CDN. Uses differential patches (bsdiff) when possible, reducing size by 10-50x.
- Verify -- Validate with SHA-256 (a cryptographic function that creates a unique fingerprint for any file) hash. Optionally verify JWT (JSON Web Token -- a compact, signed data format) RS256 signature.
- Install -- Stage the bundle for activation (immediately or on next restart).
- Stabilize -- After 2 successful launches, promote to "stable" status.
- Rollback -- If a crash is detected before stabilization, revert automatically.
Key Features
- Automatic updates -- Checks on every launch and resume. Customizable via Configuration.
- Crash detection and rollback -- Automatically reverts to the last stable version if the new bundle crashes.
- Differential patches -- Downloads only what changed. Updates are 10-50x smaller than the full bundle.
- Hermes bytecode -- Works with precompiled Hermes (React Native's JavaScript engine that runs precompiled bytecode) bundles on both platforms.
- New Architecture -- Full TurboModules (faster native module communication, replacing the old bridge) and Fabric (React Native's new rendering engine for smoother UI) support. Auto-detects at runtime.
- Code signing -- Optional RSA (a widely used encryption algorithm that uses a pair of keys: a private key to sign and a public key to verify) signing to verify updates have not been tampered with.
The SDK ships with full TypeScript definitions for all options, hooks, methods, and types.
Package Info
| Property | Value |
|---|---|
| Package | @swiftpatch/react-native |
| Version | 2.1.8 |
| React Native | >= 0.76.0 |
| React | >= 18.2.0 |
| iOS | >= 13.4 |
| Android | SDK 24+ (Android 7.0+) |
| Node.js | >= 18.0.0 |
| License | MIT |
Next Steps
| Page | What you find |
|---|---|
| Installation | Step-by-step setup for iOS and Android |
| Configuration | All SDK options -- install modes, check frequency, code signing |
| Hooks | React hooks: useSwiftPatch, useSwiftPatchUpdate, useSwiftPatchModal |
| Methods | Imperative API for manual update control |
Adding SwiftPatch to an existing app? Start with Installation. Already installed? Jump to Configuration.