Repository navigation
feat(ios): add Swift Package Manager support - #59
Merged
Merged
Conversation
Owner
|
Thanks, i'll check it tomorrow |
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-quick-base64 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 builds theios/andcpp/folders and definesRCT_NEW_ARCH_ENABLED=1, because CocoaPods gets that define frominstall_modules_dependencies. The library ships its codegen output inios/generated(includesGeneratedCode: true), so the manifest compiles that output and the app does not generate it again.spm-include/react_native_quick_base64/QuickBase64.h: SwiftPM needs a public header folder. This folder holds only one header with no API. The podspec keeps theios/headers private. Under CocoaPods thecpp/headers are public. Here they are private: as public headers, they broke@import react_native_quick_base64, becausecpp/QuickBase64Impl.hincludes the codegen headerQuickBase64SpecJSI.h.package.json: the Swift package name (swiftpmConfig.name,react_native_quick_base64) and the new files infiles. The podspec name has hyphens, which a Swift name cannot have.#57 proposed a SwiftPM manifest for React Native 0.87 and was closed. Would you like SwiftPM support in this library? I am glad to change the approach.
Test plan
npx react-native spm add --deintegrate --yes, with react-native-quick-base64 from this branch.spm addfails:Package.swift is missing for library "react-native-quick-base64".xcodebuildDebug and Release, iOS simulator: both BUILD SUCCEEDED.@import react_native_quick_base64;compiles. Withcpp/as the public folder, it failed with'QuickBase64SpecJSI.h' file not found.fromByteArrayencodesSwiftPM native base64toU3dpZnRQTSBuYXRpdmUgYmFzZTY0, andtoByteArraydecodes it back to the same text.