feat(ios): add Swift Package Manager manifests - #1907
Draft
ajpallares wants to merge 4 commits into
Draft
Conversation
The `PurchasesPlugin.swift` stub and the `*-Bridging-Header.h` placeholders have been empty since 2020 and no longer serve any purpose, but their presence makes the Obj-C targets look mixed-language to tooling that inspects sources. `#import "UIView+React.h"` only resolves through CocoaPods' header map; the namespaced `<React/UIView+React.h>` spelling is the canonical one and works under any integration method. Co-authored-by: Cursor <cursoragent@cursor.com>
React Native 0.87 shipped experimental SwiftPM support as an alternative to CocoaPods, and requires each native library to provide a Package.swift. `react-native spm scaffold` cannot generate a usable one for us: it only knows how to wire React core and sibling npm packages, so it silently drops the PurchasesHybridCommon dependency and the resulting build cannot find the module. The PHC version is now pinned in the manifests as well as the podspecs, so the bump_phc_version file list covers both. Co-authored-by: Cursor <cursoragent@cursor.com>
ajpallares
added a commit
that referenced
this pull request
Aug 20, 2026
…1906) ### Motivation Small cleanup PR in preparation for adding SwiftPM support in #1907. React Native 0.87 added experimental SwiftPM support for iOS. Its tooling refuses `react-native-purchases-ui` outright ("mixed Swift + Objective-C/C++ sources") solely because of an empty `PurchasesPlugin.swift` stub, and `#import "UIView+React.h"` only resolves through CocoaPods' header map. ### Summary - The deleted Swift stubs and bridging headers are empty and nothing references them. - `<React/UIView+React.h>` is the canonical spelling. `React-Core.podspec` sets `header_dir = "React"`, so CocoaPods resolves it identically. ### Notes No behavior change, and no test changes: the affected code is Obj-C glue with no unit test coverage. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Build and import-path cleanup with no purchase, auth, or JS API changes; intended behavior is unchanged under CocoaPods. > > **Overview** > Prepares the iOS native targets for upcoming SwiftPM work by removing unused Swift scaffolding and aligning React header imports with the canonical CocoaPods/SwiftPM spelling. > > **Empty Swift removed:** Deletes stub `PurchasesPlugin.swift`, bridging headers, and Xcode references from `RNPurchases` and `react-native-purchases-ui` so the UI package is no longer classified as mixed Swift + Obj-C for RN 0.87’s experimental SwiftPM tooling. `AGENTS.md` now documents iOS as Obj-C only (`RNPurchases.h` / `RNPurchases.m`). > > **React imports:** `CustomerCenterViewWrapper.m` and `PaywallViewWrapper.m` switch from `#import "UIView+React.h"` to `#import <React/UIView+React.h>`, matching `React-Core`’s `header_dir` and avoiding header-map-only resolution. > > No runtime or public API changes; Obj-C glue only. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 94e7085. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Cursor <cursoragent@cursor.com>
Asserts each manifest stays consistent with its podspec, keeps the autolinked package name, and covers every source in its target, so a change that only breaks the SwiftPM build fails CI too. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Solves SDK-4436
Motivation
React Native 0.87's experimental SwiftPM path requires every native library to ship a
Package.swift.npx react-native spm scaffoldcannot generate a usable one for us — it only wires React core and sibling npm packages, so it silently dropsPurchasesHybridCommonand the build fails withModule 'PurchasesHybridCommonUI' not found.Summary
xcodebuildruns of an RN 0.87.0 app on Xcode 26.6, in two app layouts, confirming the bridge modules and view managers link into the binary.bump_phc_versionrewrites the manifests, and tests assert each one stays consistent with its podspec so a SwiftPM-only regression fails CI.Notes
ReactNativepackage path only works in RN's local mode, and encodes RN's private autolinking layout. RN calls the whole path unstable and not production-ready, hence draft.