Repository navigation
Add Swift Package Manager support - #6
Merged
Merged
Conversation
retyui
force-pushed
the
spm-support
branch
2 times, most recently
from
November 26, 2026 10:28
0960295 to
0c2a87b
Compare
4 tasks
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.
Adds a hand-written
Package.swiftso React Native's SPM autolinker (RN 0.87+) picks the library up as a self-managed package. CocoaPods keeps usingDetectMaestro.podspec, unchanged.Ref: callstack/react-native-image-editor#215
Changes
Package.swift: SPM can't compile Swift and ObjC++ in one target, so sources are split:DetectMaestroImpl(Swift) —DetectMaestroModuleImpl.swiftDetectMaestro(ObjC++) — the RN module, depends onDetectMaestroImpl(one-way, no cycle)RCT_NEW_ARCH_ENABLED=1(SPM is New Architecture only) andDEBUG/NDEBUGto match the prebuilt React framework.ios/DetectMaestroModule.mm:__has_includeguards so the same file builds under both:DetectMaestro-Swift.hand"DetectMaestro.h"as before.<ReactCodegen/DetectMaestro/DetectMaestro.h>and declares the@objc(DetectMaestroModuleImpl)interface directly (@importisn't allowed in ObjC++ without-fcxx-modules).package.json:swiftpmConfig.name = "DetectMaestro", andPackage.swiftadded tofiles.main.yml):Build Android,Build iOS (CocoaPods)andBuild iOS (SPM)jobs on RNlatest(macos-15+ Xcode 16.4 for iOS).build-appcreates apps with@react-native-community/cli init --pm yarn, links the module viaportal:, and usesnpx pod-installorspm add --deintegrate. Legacyreact-native initis kept for RN < 0.75 (E2E). Node 20 / Ruby 3.2 defaults.README.md: SPM note..gitignore: SPM build artifacts.Testing
Fresh RN 0.88.1 app, library installed from
npm pack:npx react-native spm add --deintegrate): Debug + Release builds succeed; app runs on simulator andDetectMaestro.isMaestro()returnsfalse.pod install): Release build succeeds; same runtime result.Not tested: CocoaPods on older RN (0.65–0.72) / old architecture (that code path is unchanged).