Repository navigation
Conversation
Add a Package.swift so apps that use React Native's SwiftPM mode (React Native 0.88+) can link the picker. CocoaPods users see no change. swiftpmConfig.name keeps the podspec name, RNCPicker.
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 link native libraries with Swift Package Manager (SwiftPM) instead of CocoaPods. This PR adds SwiftPM support for iOS. CocoaPods users see no change, and no source files change.
Package.swiftat the repo root. React Native's SwiftPM autolinker uses it only when an app runs in SwiftPM mode.package.json:Package.swiftis added tofiles, andswiftpmConfig.nameis set toRNCPicker, the same name the podspec uses.How to verify
npx react-native spm add --deintegrate --yesin the app.BUILD SUCCEEDED.onValueChange.I did these steps on an iPhone simulator (iOS 27) with React Native 0.88.0.
Details
RNCPickerTarget; the product isRNCPicker. If the target is namedRNCPicker, SwiftPM treatsios/RNCPicker.has an umbrella header and then rejects theRNCPicker.xcodeprojfolder next to it, even when it is excluded. React Native links only the product, so apps never see the target name.RCT_NEW_ARCH_ENABLED. CocoaPods gets this define frominstall_modules_dependencies. SwiftPM does not, soPackage.swiftsets it. Without it, the Fabric component compiles empty and is never registered.../../../../xcframeworksand../../../iosresolve from the folder where React Native's autolinker links the package (<app>/build/generated/autolinking/libs/RNCPicker). They are not meant to resolve from the repo itself.