Skip to content

feat: SPM compatibility - #779

Open
hejsztynx wants to merge 3 commits into
@kacperzolkiewski/upgrade-examplefrom
@ksienkiewicz/feat-spm-compatibility
Open

feat: SPM compatibility#779
hejsztynx wants to merge 3 commits into
@kacperzolkiewski/upgrade-examplefrom
@ksienkiewicz/feat-spm-compatibility

Conversation

@hejsztynx

@hejsztynx hejsztynx commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Mainly, it was needed to change the iOS imports structure, as SPM and CocoaPods have different preferences.

Every change in the apps/example is just for testing purposes and will not be committed in the merge. The react-native-image-picker functionality got stripped, as it doesn't support SPM.

SPM works with the internal example app. I also simulated a non-local environment by installing the recently published react-native-enriched-html release into a fresh RN 0.87 bare-bone example app and applied the ios changes - it works there as well.

Test Plan

Run the example app with SPM

In the apps/example directory:

  1. first build the app normally with CocoaPods, with yarn ios, verify it works
  2. in react-native-config.js set automaticPodsInstallation to false
  3. remove the react-native-image-picker dependency from package.json and reinstall dependencies
  4. run npx react-native spm scaffold, Package.swift should not be changed by that
  5. in the root Package.swift add "apps" and "docs" to the exclude list. This is needed as we physically have example apps within the library source code and don't want to try to resolve source there to compile; otherwise SPM would get confused (duplicated resources, infinite symlink loops)
  6. we run npx react-native spm --deintegrate to remove CocoaPods from this app
  7. we can finally run the build with yarn ios

More info: RN blog post

Compatibility

OS Implemented
iOS
Android
Web

Copilot AI lite review requested due to automatic review settings August 19, 2026 10:27
mediaType: 'photo',
selectionLimit: 1,
});
const response: any = undefined;

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.

Stripped react-native-image-picker functionalities for testing purposes only. This will be removed before merging

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds Swift Package Manager (SPM) scaffolding support and updates iOS headers/import paths to build cleanly under SPM while keeping CocoaPods compatibility.

Changes:

  • Added Package.swift and an SPM “prefix header” to emulate CocoaPods’ prefix-header behavior.
  • Updated iOS header imports to use local and codegen header paths (vs module-style includes).
  • Adjusted podspec header search paths to support the new include strategy.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
react-native-spm-prefix.h Adds a forced-include prefix header for SPM builds (Foundation/UIKit).
package.json Publishes Package.swift and the prefix header in the npm package.
ios/internals/EnrichedTextViewShadowNode.h Switches to local + codegen include paths for SPM compatibility.
ios/internals/EnrichedTextInputViewShadowNode.h Switches to local + codegen include paths for SPM compatibility.
ios/internals/EnrichedTextInputViewComponentDescriptor.h Updates includes to local + codegen paths.
ios/internals/EnrichedTextComponentDescriptor.h Updates includes to local + codegen paths.
ios/interfaces/LinkRegexConfig.h Updates Props include to the generated codegen path.
ios/EnrichedTextView.mm Updates imports to local/component descriptor + generated codegen headers.
ios/EnrichedTextInputView.mm Updates imports to local/component descriptor + generated codegen headers.
apps/example/src/hooks/useEditorState.ts Modifies image-picker logic (currently stubbed).
ReactNativeEnrichedHtml.podspec Expands HEADER_SEARCH_PATHS to include the repo root for quoted includes.
Package.swift Introduces an SPM package definition for the library target.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread apps/example/src/hooks/useEditorState.ts
Comment thread Package.swift
Comment thread react-native-spm-prefix.h Outdated
@hejsztynx
hejsztynx marked this pull request as draft August 19, 2026 10:33
@hejsztynx
hejsztynx force-pushed the @ksienkiewicz/feat-spm-compatibility branch from e07a47d to 0470f9b Compare August 19, 2026 12:18
@hejsztynx
hejsztynx marked this pull request as ready for review August 19, 2026 12:22
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.

2 participants