Using multiple KMP modules in Swift

For simplicity’s sake let’s consider a following dependency graph:

  • kmpA (depends on kmpB)
  • kmpB (no deps)
  • swiftC (depends on kmpA and swiftD)
  • swiftD (depends on kmpB)

I’m trying to pass an object of type X (declared in kmpB) from swiftC to swiftD. Looking at mismatch type compiler error it seems that when kmpA and kmpB are built into xcframework they both expose type X with a different prefix kmpAX and kmpBX so essentially compiler sees them as 2 different types even though they have a common source.

Is there some way to configure build.gradle.kts to make sure that we only have one X type and that kmpA is actually using kmpB types? Please bear in mind I’m coming from Swift env and don’t have much experience with android or gradle.