I'm trying to bundle couple KMM modules into one and make them accessible in iOS. I have moduleA and it imports moduleB like so:
val commonMain by getting {
dependencies {
api(project(mapOf("path" to ":moduleB")))
}
}
In android, if I import moduleA, I can also directly access classes from moduleB. But on iOS, I can only see classes from moduleA. Is there a way to get moduleB classes visible in iOS as well without moving everything into moduleA?
You need to manually configure the native framework to export the modules you want accessible to iOS:
framework {
....
transitiveExport = true
export(project(":moduleB"))
}
See also: https://akjaw.com/modularizing-a-kotlin-multiplatform-mobile-project/