Repository navigation
Conversation
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.
Overview
React Native 0.88 can link iOS libraries with Swift Package Manager (SwiftPM) instead of CocoaPods. An app in SwiftPM mode cannot use the slider today: the build stops with
Package.swift is missing for library "@react-native-community/slider".This PR adds SwiftPM support in
package/. No file underios/orcommon/changes, and the CocoaPods setup is not touched.package/Package.swift: the manifest that React Native's SwiftPM autolinking uses.ReactNativeSlider. The podspec namereact-native-slideris not a valid Swift identifier, so the SwiftPM name is set explicitly (see item 3).ios/andcommon/cpp/, and excludes the other root entries so SwiftPM does not scan the example or other folders.RCT_NEW_ARCH_ENABLED=1for C, Objective-C and C++, which CocoaPods gets frominstall_modules_dependencies.package/include/ReactNativeSlider/: the public headers, each forwarding to the file inios/.package/spm-headers/:RCTImagePrimitivesConversions.handRCTFabricComponentsPlugins.h, which the sources import by bare name. They forward to<react/renderer/imagemanager/RCTImagePrimitivesConversions.h>and<React/RCTFabricComponentsPlugins.h>.package/package.json: setsswiftpmConfig.nametoReactNativeSlider, which React Native 0.88 reads for the SwiftPM product name. The package has nofileslist, so the new files are published without further changes.Test Plan
npx react-native spm add --deintegrate, the slider from this branch.Package.swift is missing for library "@react-native-community/slider".xcodebuildDebug for the iOS Simulator ends with** BUILD SUCCEEDED **. No warnings come from the manifest.Slider(0 to 100, value 40) renders with custom track colours, andUIManager.hasViewManagerConfig('RNCSlider')is true.npm pack --dry-runinpackage/includesPackage.swift,include/andspm-headers/.