Repository navigation
Conversation
Adds Package.swift so apps that build iOS with React Native's SwiftPM support (react-native >= 0.87, `npx react-native spm`) can autolink the slider without scaffolding a manifest from the podspec. CocoaPods is unaffected: the podspec stays the source of truth there. Two React Native headers are included by bare name in RNCSliderComponentView.mm; CocoaPods resolves that through header maps, SwiftPM only offers them namespaced. Each include now prefers the namespaced header via __has_include and falls back to the old one, so the CocoaPods build is unchanged. The two React Native packages resolve through the autolinker's libs/<name> alias at app resolve time, the same shape react-native-safe-area-context ships. Adds `swiftpmConfig.name`.
Author
|
Closing: the app that prompted this no longer uses the native slider, so there is no need for a SwiftPM manifest from our side. The notes in the description (React Native's SwiftPM autolinker, the namespaced header includes and the |
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:
Adds a
Package.swiftso apps that build iOS with React Native's SwiftPM support (react-native >= 0.87,npx react-native spm) can autolink the slider without scaffolding a manifest from the podspec first. CocoaPods is unaffected; the podspec stays the source of truth there.Related: #832 proposed the raw
react-native spm scaffoldoutput and was closed. This one is hand-written likereact-native-safe-area-context's manifest and was built and run, see the test plan.package/Package.swift: one target overios/andcommon/cpp(same files as the podspec and itscommonsubspec),ios/RNCSlider.xcodeprojexcluded. The two React Native packages resolve through the autolinker'sbuild/generated/autolinking/libs/react-native-slideralias at app resolve time, so the manifest does not resolve in a bare clone (same as safe-area-context). It carries the compiler flags CocoaPods gives pods through React Native's setup;FOLLY_CFG_NO_COROUTINES=1is the one that matters, without it folly includes<folly/coro/Coroutine.h>, which the prebuilt React Native headers don't ship.ios/RNCSliderComponentView.mm: two React Native headers are imported by bare name (RCTImagePrimitivesConversions.h,RCTFabricComponentsPlugins.h). CocoaPods resolves that through header maps; SwiftPM only offers them namespaced. Each import now prefers the namespaced header via__has_includeand falls back to the old bare import, so the CocoaPods build resolves exactly what it did before.package.json:swiftpmConfig.name. The package has nofileslist, soPackage.swiftis published as is.Test Plan:
Built and run on the iOS simulator with react-native 0.88.0, no CocoaPods, and no scaffold patches for this library:
@react-native-community/slider5.2.2 (published; identical tomain) plus thisPackage.swiftand.mm.npx react-native spm scaffold --deintegrate --yes, thenxcodebuildfor the iOS simulator in Release: BUILD SUCCEEDED. The autolinker logs "Self-managed: react-native-slider (using its own Package.swift)".Not run: the CocoaPods build (by construction the
__has_includefallback keeps the old import), macOS/visionOS/Windows.🤖 Generated with Claude Code