Skip to content

[feat] add local iOS SPM package output#358

Merged
adamTrz merged 9 commits into
mainfrom
feat/add-ios-local-spm-package
Jun 9, 2026
Merged

[feat] add local iOS SPM package output#358
adamTrz merged 9 commits into
mainfrom
feat/add-ios-local-spm-package

Conversation

@adamTrz

@adamTrz adamTrz commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add --add-spm-package to brownfield package:ios so iOS packaging can emit a local Swift Package next to the packaged XCFrameworks
  • generate Package.swift and README.md, and normalize copied spm-artifacts for local SPM consumption, including Hermes, ReactBrownfield, Brownie, BrownfieldNavigation, plus React and ReactNativeDependencies when present
  • document local-package integration and update the AppleApp example flow so SPM validation no longer depends on prepareXCFrameworks.js rewriting Swift sources
image

Why

We want an incremental path toward Swift Package Manager consumption of packaged RN iOS artifacts before the wider RN core migration lands.

During validation, two follow-up issues showed up and are included in this PR:

  • prebuilt RN XCFrameworks could retain stale signature metadata that Xcode rejects when consumed through local SPM
  • AppleApp's Expo example targets and host shell labeling still relied on legacy prepareXCFrameworks.js source rewriting, which the local SPM path does not run

Validation

  • yarn workspace @callstack/brownfield-cli lint
  • yarn workspace @callstack/brownfield-cli typecheck
  • yarn workspace @callstack/brownfield-cli test
  • corepack yarn workspace @callstack/brownfield-cli test src/brownfield/utils/__tests__/createLocalSpmPackage.test.ts
  • manual validation: generated the local package from apps/RNApp, added it to AppleApp in Xcode, and confirmed the host app builds and runs without Metro
  • manual validation: generated the local package from apps/ExpoApp55, added it to AppleApp in Xcode, and confirmed the host app builds, installs, and launches

Notes

  • AppleApp still keeps the legacy direct-XCFramework integration path in-repo by default; the project/source changes in this PR only make the example host compatible with local SPM validation and remove reliance on Swift source mutation during packaging

@adamTrz adamTrz changed the title [codex] add local iOS SPM package output [fest] add local iOS SPM package output May 28, 2026
@adamTrz adamTrz force-pushed the feat/add-ios-local-spm-package branch from 6418700 to d3f3898 Compare May 28, 2026 08:15
@adamTrz adamTrz changed the title [fest] add local iOS SPM package output [feat] add local iOS SPM package output May 28, 2026

@hurali97 hurali97 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀


1. Select your host app target
2. Open the **General** tab
3. Under **Frameworks, Libraries, and Embedded Content**, add the package product named after your packaged framework, for example `BrownfieldLib`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this means? Does this step says how to add Package.swift to the Host App?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not, perhaps we can add a note:

"Go to Project -> Package Dependencies -> Click on + -> Add Local -> Select the directory with Package.swift file, in this case it should be under `.brownfield/package/build"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarified this in the docs. It now explicitly says to open the host app project in Xcode, go to Package Dependencies, click +, choose Add Local..., and select the .brownfield/package/build directory containing Package.swift.

@adamTrz adamTrz marked this pull request as ready for review June 1, 2026 08:15

@artus9033 artus9033 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@adamTrz adamTrz requested a review from hurali97 June 9, 2026 09:43

@hurali97 hurali97 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adamTrz adamTrz merged commit 3715ac7 into main Jun 9, 2026
16 checks passed
@adamTrz adamTrz deleted the feat/add-ios-local-spm-package branch June 9, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants