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 datetimepicker today: the build stops with
Package.swift is missing for library "@react-native-community/datetimepicker".This PR adds SwiftPM support. No file under
ios/changes, and the CocoaPods setup is not touched.Package.swift: the manifest that React Native's SwiftPM autolinking uses.RNDateTimePicker, the same name as the podspec.RNDateTimePickerTargetand usesios/as its path, withpublicHeadersPath: ".". With the target named likeRNDateTimePicker.h, SwiftPM would treat that header as an umbrella header next toRNDateTimePicker.xcodeproj, so the target name differs from the product name. Apps link the product only.fabric/andfabric/cpp/let the existing quoted includes in the Fabric sources resolve without source edits.RCT_NEW_ARCH_ENABLED=1for C, Objective-C and C++, which CocoaPods gets frominstall_modules_dependencies.package.json: addsPackage.swifttofiles, and setsswiftpmConfig.name, which React Native 0.88 reads for the SwiftPM product name.I saw that an earlier SwiftPM PR (#1068) was closed. This one is limited to the two files above, and I am happy to change it to fit how you want this done.
Test Plan
npx react-native spm add --deintegrate, datetimepicker from this branch.Package.swift is missing for library "@react-native-community/datetimepicker".xcodebuildDebug for the iOS Simulator ends with** BUILD SUCCEEDED **. No warnings come from the manifest.DateTimePickerwithdisplay="inline"andmode="date"shows the native calendar with the set date selected.npm pack --dry-runincludesPackage.swift.