Skip to main content

Project Structure

Here's how a SwiftPatch-enabled project is organized and the key concepts you'll work with.


Key Concepts

Apps

An App represents your React Native application in SwiftPatch. Each app has:

  • A unique App ID
  • Platform targets (iOS, Android, or both)
  • Associated releases

Environments

Each app supports two environments:

EnvironmentPurpose
ProductionLive updates for end users
StagingTest updates before production
Switching environments

Call switchEnvironment() at runtime, or set autoStagingInDev: true to use staging in dev builds automatically.

Releases

A Release is a JavaScript bundle published to SwiftPatch. Each release includes:

  • A target app version
  • Release notes
  • Rollout percentage
  • An optional mandatory flag

Bundle Slots

SwiftPatch uses a three-slot system for safe updates:

SlotDescription
DEFAULT_SLOTOriginal bundle shipped with the app binary
STABLE_SLOTVerified, known-good OTA bundle
NEW_SLOTRecently installed OTA bundle, pending verification
How slots work

New updates land in NEW_SLOT. After successful launches, they promote to STABLE_SLOT. If crashes are detected, the SDK falls back to STABLE_SLOT or DEFAULT_SLOT.


File Structure

your-app/
├── node_modules/@swiftpatch/react-native/ # SDK package
├── ios/
│ ├── YourApp/
│ │ ├── AppDelegate.swift # Loads SwiftPatch bundle
│ │ └── Info.plist # SwiftPatchAppId
│ └── Pods/ # CocoaPods dependencies (auto-linked)
├── android/
│ ├── app/src/main/
│ │ ├── java/.../MainApplication.kt # Loads SwiftPatch bundle
│ │ └── res/values/strings.xml # SwiftPatchAppId
│ └── build.gradle # Dependencies (auto-linked)
├── App.tsx # withSwiftPatch wrapper
└── .swiftpatchrc # Project config (from swiftpatch init)

Bundle Loading Flow


Next Steps