Skip to content

feat(ios): add Swift Package Manager manifests - #1907

Draft
ajpallares wants to merge 4 commits into
mainfrom
pallares/spm-package-manifests
Draft

feat(ios): add Swift Package Manager manifests#1907
ajpallares wants to merge 4 commits into
mainfrom
pallares/spm-package-manifests

Conversation

@ajpallares

@ajpallares ajpallares commented Aug 19, 2026

Copy link
Copy Markdown
Member

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 scaffold cannot generate a usable one for us — it only wires React core and sibling npm packages, so it silently drops PurchasesHybridCommon and the build fails with Module 'PurchasesHybridCommonUI' not found.

Summary

  • Hand-authored manifests for both packages, resolving PHC through its existing Swift package. Verified with Debug and Release xcodebuild runs 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_version rewrites the manifests, and tests assert each one stays consistent with its podspec so a SwiftPM-only regression fails CI.

Notes

  • The ReactNative package 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.
  • No CI job builds a SwiftPM app yet, so the manifests are only covered statically.

ajpallares and others added 2 commits August 19, 2026 18:03
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 ajpallares added the pr:feat A new feature label Aug 19, 2026
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>
Base automatically changed from pallares/spm-ios-source-hygiene to main August 20, 2026 06:54
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant