简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM