Skip to main content

Migrating to v2.0

info

The API is fully compatible with v1.x. The only required change is updating your import paths from swiftpatch-react-native to @swiftpatch/react-native.

What is New in v2.0

  • 40% faster with New Architecture support
  • React Native 0.76+ compatibility
  • TurboModules (faster native module communication) + Fabric renderer (smoother UI rendering)
  • Smaller bundle sizes
  • Better TypeScript types
  • Enhanced security features

Step 1: Update Package

npm install @swiftpatch/react-native@2.0.0

Step 2: Update React Native (if needed)

v2.0 requires React Native 0.76+:

npm install react-native@0.76.5

Step 3: Update Native Code

iOS:

cd ios && pod install && cd ..

Android: No additional steps needed.

Step 4: Rebuild

npx react-native run-ios
npx react-native run-android

Step 5: (Optional) Enable New Architecture

iOS (ios/Podfile):

ENV['RCT_NEW_ARCH_ENABLED'] = '1'

Android (android/gradle.properties):

newArchEnabled=true

Then reinstall and rebuild:

cd ios && pod install && cd ..
npx react-native run-ios
npx react-native run-android
tip

Enabling New Architecture is optional but gives you the best performance. You can always enable it later.

Compatibility

SwiftPatchReact NativeReactiOSAndroidNew Arch
v2.0.00.76.0+18.2.0+13.4+API 24+Yes
v1.x0.69.0+16.8.0+13.0+API 24+No

Testing Your Migration

Verify Installation

npx react-native run-ios
# Look for: [SwiftPatch] SDK initialized successfully

Check Architecture

import { IS_TURBO_MODULE_ENABLED } from '@swiftpatch/react-native';
console.log('TurboModules enabled:', IS_TURBO_MODULE_ENABLED);

Troubleshooting

iOS build errors

cd ios
rm -rf Pods Podfile.lock build
pod deintegrate
pod install
cd ..

Android build errors

cd android && ./gradlew clean && ./gradlew --stop && cd ..
npx react-native run-android

Module not found

Make sure you are using the scoped package name:

// Correct (v2.0)
import { SwiftPatchProvider } from '@swiftpatch/react-native';

// Old (v1.x)
import { SwiftPatchProvider } from 'swiftpatch-react-native';

Performance

Operationv1.xv2.0 (Legacy)v2.0 (New Arch)
Check Update20ms15ms2ms
Install Bundle500ms450ms250ms
Memory Usage50MB45MB32MB

Rollback Plan

If something goes wrong, you can always go back to v1.x:

npm install @swiftpatch/react-native@1.x.x
cd ios && pod install && cd ..

Next Steps