Skip to content

Fix: Xcode 26 build workaround for package consumers#322

Merged
robertherber merged 5 commits intokingstinct:masterfrom
AlshehriAli0:fix/xcode-26-podspec-workaround
Feb 24, 2026
Merged

Fix: Xcode 26 build workaround for package consumers#322
robertherber merged 5 commits intokingstinct:masterfrom
AlshehriAli0:fix/xcode-26-podspec-workaround

Conversation

@AlshehriAli0
Copy link
Contributor

@AlshehriAli0 AlshehriAli0 commented Feb 24, 2026

Follow-up to #318

The previous PR fixed the nitro 0.33 migration and added a fix-codegen script, 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_phase to the podspec that patches the generated files before compilation, so it works on every machine automatically.

Adds a before_compile script phase that patches nitrogen-generated
Bool(fromCxx:) calls for Swift 6.2 CxxConvertibleToBool compatibility.
@changeset-bot
Copy link

changeset-bot bot commented Feb 24, 2026

🦋 Changeset detected

Latest commit: 6811d23

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kingstinct/react-native-healthkit Patch

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

@AlshehriAli0
Copy link
Contributor Author

@robertherber

@robertherber
Copy link
Member

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?

@AlshehriAli0
Copy link
Contributor Author

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/kingstinct/react-native-healthkit/@kingstinct/react-native-healthkit@322

commit: 6811d23

@robertherber
Copy link
Member

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

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?

@robertherber
Copy link
Member

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?

@AlshehriAli0
Copy link
Contributor Author

@robertherber bumped it but keeps failing and using Xcode 16 because the ci event is set to pull_request_target

@robertherber robertherber merged commit de6fab5 into kingstinct:master Feb 24, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants