HI guys mb someone knows is there any way to creat...
# android
i
HI guys mb someone knows is there any way to create two shared modules with KMM project (for example shared and feature) and use it both in ios app via cocoapods(as i undersand via regular frameworks its restricted bc only one searching path)? also if yes can i make one of theese modules dependent from anouther (module feature implements shared)?
c
I had this exact topic this morning 😄 I'm using Framework instead of Cocoapods, but should be no difference. • You can create multiple KMM modules same as any other gradle module • If module
module-a
depends on
module-b
, add following to the
commonMain
source set of `module-a`:
implementation(project(":module-b"))
• Add exports for each module you depend on (this might be a bit different for you, but look for an export function
Copy code
listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {
        it.binaries.framework {
            baseName = "shared-base"
            export(project("module-b"))
        }
    }
The important lesson for me was that you can only include one KMM module into your iOS app. It only exposes the classes inside this module and not classes of any other module you added with
implementation
. To export the classes of a module you added with
implementation
as well, you need to add a
export(project(...))
directive
You can see my project here, see the
shared-
modules
i
@Christian Würthenr thank you now faced with problem of same names in different modules now need to rename🐛