Repository navigation
Conversation
React Native 0.88 can build libraries with Swift Package Manager instead of CocoaPods, but react-native-pdf has no Package.swift, so SwiftPM apps cannot use it. This adds a Package.swift that React Native's SwiftPM autolinker uses, a prefix header that matches the CocoaPods default, and package.json entries for the Swift package name and the published files. CocoaPods users see no change, and no source file changes. - RCT_NEW_ARCH_ENABLED=1 is defined in the manifest, because CocoaPods gets it from install_modules_dependencies and the Fabric view needs it. - The manifest excludes every root entry it does not use, so SwiftPM does not scan example/ or node_modules/ for resources, in a checkout and in an npm install. Tested on React Native 0.88.0, iOS 27 simulator: Debug build succeeds, and a 3-page PDF loads and renders.
chrfalch
marked this pull request as ready for review
November 9, 2026 10:16
johanholm
approved these changes
Nov 11, 2026
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.
Summary
React Native 0.88 can build iOS libraries with Swift Package Manager (SwiftPM) instead of CocoaPods. react-native-pdf has no
Package.swift, so apps that use SwiftPM cannot use it.This PR adds SwiftPM support. CocoaPods users see no change, and no source file changes.
Package.swift: the manifest that React Native's SwiftPM autolinking uses. It definesRCT_NEW_ARCH_ENABLED=1, because CocoaPods gets that define frominstall_modules_dependenciesand the Fabric view needs it.example/ornode_modules/for resources.react-native-spm-prefix.h: a prefix header that matches the CocoaPods default.package.json: the Swift package name (swiftpmConfig.name) and the new files infiles.SwiftPM support also needs react-native-blob-util 1.1.1 or later. That release adds the Swift package name for blob-util (RonRadtke/react-native-blob-util#507). CocoaPods users can keep any blob-util version.
Would you like SwiftPM support in this library? I am glad to change the approach.
Test plan
npx react-native spm add --deintegrate, with react-native-pdf from this branch and react-native-blob-util 1.1.1 from npm, without changes.xcodebuildDebug and Release, iOS 27 simulator: both BUILD SUCCEEDED.