Repository navigation
Conversation
ofalvai
force-pushed
the
spm-package-manifest
branch
from
October 27, 2026 20:56
0041dff to
596ea8b
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The unconditional local dependency in Package.swift blocks package resolution for apps using RN_SPM_REMOTE_URL or a custom --xcframeworks-path when the default build/xcframeworks package is absent.
1 open issue
What changed in this PR
Adds Swift Package Manager integration for CodePush in React Native apps while preserving CocoaPods support.
Changes:
- Defines SwiftPM targets for the native bridge, Swift core, and binary patching code.
- Adds autolinking metadata and public header exposure.
- Adjusts native imports for SwiftPM and narrows the CocoaPods source glob.
| File | Description |
|---|---|
Package.swift |
Defines products, targets, dependencies, and native linker settings. |
package.json |
Adds the CodePush SwiftPM autolinking name. |
ios/CodePush/include/module.modulemap |
Exposes the CodePush module to consumers. |
ios/CodePush/include/CodePush/CodePush.h |
Adds a forwarding header for public imports. |
ios/CodePush/CodePushUpdateUtils.m |
Imports the separate Swift core module under SwiftPM. |
ios/CodePush/CodePushPackage.m |
Selects the ZipArchive import for SwiftPM. |
CodePush.podspec |
Removes Swift files from the bridge-directory source glob. |
Review effort: Balanced
| .library(name: "CodePush", targets: ["CodePush"]), | ||
| ], | ||
| dependencies: [ | ||
| .package(name: "ReactNative", path: reactNativePackagePath), |
ofalvai
force-pushed
the
spm-package-manifest
branch
from
October 28, 2026 10:31
596ea8b to
fc6051f
Compare
ofalvai
force-pushed
the
spm-package-manifest
branch
2 times, most recently
from
October 28, 2026 10:50
cf02fa1 to
5177ea3
Compare
ofalvai
commented
Oct 28, 2026
| s.libraries = 'z', 'bz2' | ||
| s.source_files = [ | ||
| 'ios/CodePush/*.{h,m,swift}', | ||
| 'ios/CodePush/*.{h,m}', |
Collaborator
Author
There was a problem hiding this comment.
This is meant to prevent accidentally picking up .swift files from the main CodePush source dir. New Swift code should go to CodePushCore
React Native 0.88 autolinks a library that ships its own Package.swift. The manifest sits at the package root because the HDiffPatch sources in shared/ are outside ios/, and target paths cannot leave the package root. The React header products come from the app's ReactNative package. The autolinker loads the manifest through build/generated/autolinking/libs/CodePush, so the relative path ../../../../xcframeworks reaches it in every app. This is the same path that `react-native spm scaffold` emits, and that react-native-safe-area-context ships. Targets: CodePush (Objective-C), CodePushCore (Swift) and CodePushHDiffPatch (C, same defines as the podspec). ZipArchive is a remote dependency. A custom module map is necessary because SwiftPM rejects an umbrella header next to the vendored SSZipArchive directory. The podspec flow does not change: SWIFT_PACKAGE is only defined by SwiftPM. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ofalvai
force-pushed
the
spm-package-manifest
branch
from
October 28, 2026 12:58
5177ea3 to
643d0ed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Part 4 of the stack: #94 → #95 → #96 → this PR.
RN 0.89 makes Swift Package Manager the default for iOS apps. RN 0.88 already autolinks a library that ships its own
Package.swift. This PR adds that manifest, so CodePush works in an SPM app. CocoaPods consumers see no change.What changes
Package.swiftat the repository root. The HDiffPatch sources are inshared/, outsideios/, and an SPM target path cannot leave the package root, so the manifest needs to be in the root.ios/CodePush/goes back to*.{h,m}. SwiftPM builds that directory as an Objective-C target and rejects Swift files in it. The podspec now follows the same rule.Why CodePushCore has two manifests
#94 added
ios/CodePushCore/Package.swift, and it is only for tests:npm run test:unit:ios:coreuses it to run the verifier tests on a simulator. The root manifest cannot do this, because itsReactNativedependency resolves only when the autolinker loads the manifest from inside an app. Both manifests point at the sameSources/directory, so the code exists only once.Open questions
🤖 Generated with Claude Code