Import one KMM module into another and expose it's classes to iOS

Viewed 23

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?

1 Answers

Turns out it actually works by default, just all the classes from moduleB get a prefix moduleBClassName. It doesn't even matter if you use api, or implementation. All files are exposed to ios.

Related