mrousavy / nitro

🔥 Insanely fast native C++, Swift or Kotlin modules with a statically compiled binding layer to JSI
https://nitro.margelo.com
MIT License
598 stars 15 forks source link

Generated Swift header cannot find `HybridXXXXSpecCxx` #133

Closed mrousavy closed 1 month ago

mrousavy commented 1 month ago

When creating a Swift Hybrid Object and autolinking it, the generated header might fail to find the HybridXXXXSpecCxx class definition as seen here: image

This is because Nitrogen does not track Hybrid Objects when no public API is using that Hybrid Object.

A "workaround" would be to add a function or getter that returns this/self:

interface FetchModule extends HybridObject<...> {
  getSelf(): FetchModule // <-- just returns self/this
}

This will be fixed soon by just also throwing every Hybrid Object into the "getAllTypes()" list.