Fix: Xcode 26 build workaround for package consumers#322
Conversation
Adds a before_compile script phase that patches nitrogen-generated Bool(fromCxx:) calls for Swift 6.2 CxxConvertibleToBool compatibility.
🦋 Changeset detectedLatest commit: 6811d23 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks! But since codegen runs before publishing (and includes the generated files which are postprocessed by the script you added previously) should this really be needed? |
On paper that is absolutely correct, but when i tried installing the package on a different project not the example app, i got: ❌ (node_modules/@kingstinct/react-native-healthkit/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift:78:8)
76 | public func getCxxPart() -> bridge.std__shared_ptr_HybridWorkoutProxySpec_ {
77 | let cachedCxxPart = self.__cxxPart.lock()
> 78 | if Bool(fromCxx: cachedCxxPart) {
| ^ initializer 'init' requires that 'std.__1.shared_ptr<margelo.nitro.healthkit.HybridWorkoutProxySpec>' conform to 'CxxConvertibleToBool'
79 | return cachedCxxPart
80 | } else {
81 | let newCxxPart = bridge.create_std__shared_ptr_HybridWorkoutProxySpec_(self.toUnsafe())which seems like the script didnt run correctly, so this is an attempt to make sure it gets run correctly |
commit: |
But it seems like the iOS build is failing in CI with this: https://github.com/kingstinct/react-native-healthkit/actions/runs/22350379740 While it actually succeeded previously. Are you sure you've done a clean rebuild after upgrading to 13.2.2? |
|
Aah I see now that our CI is using Xcode 16.4 and not 26. Could you bump it as part of this PR so we see it succeeds? |
|
@robertherber bumped it but keeps failing and using Xcode 16 because the ci event is set to |
Follow-up to #318
The previous PR fixed the nitro 0.33 migration and added a
fix-codegenscript, but that script only runs in the monorepo. Package consumers installing via npm still get the unpatched nitrogen-generated files, causing builds to fail on Xcode 26 (Swift 6.2).This adds a
script_phaseto the podspec that patches the generated files before compilation, so it works on every machine automatically.