https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
n

Nikola Milovic

05/25/2021, 6:16 AM
Copy code
sourceSets {
        named("commonMain") {
            dependencies {
                implementation(project(":common:utils"))
                implementation(project(":common:database"))
                implementation(project(":common:main"))
                implementation(project(":common:edit"))
                implementation(Deps.ArkIvanov.MVIKotlin.mvikotlin)
                implementation(Deps.ArkIvanov.Decompose.decompose)
                implementation(Deps.Badoo.Reaktive.reaktive)
            }
        }
    }

    sourceSets {
        named("iosMain") {
            dependencies {
                api(project(":common:database"))
                api(project(":common:main"))
                api(project(":common:edit"))
            }
        }
From the Compose Todo sample app. Can someone explain to me why are we implementing the projects in the commonMain and then api them in the iosMain? Doesnt iosMain inherit from the commonMain? What do we achieve/ what's happening here?
r

rnett

05/25/2021, 6:46 AM
api
and
implementation
both add the dependency,
api
just exposes it to other libs that depend on this one. I'm not sure why those dependencies are there at all, tbh, I would think they would be included from common. If there's another module that depends on
iosMain
it may just to be to expose the dependencies.
n

Nikola Milovic

05/25/2021, 7:35 AM
@rnett Thank you. It was confusing me, but this makes sense
j

Jan M

05/26/2021, 2:57 PM
@Nikola Milovic can you share the link to this project? I am struggling with my multi-module setup and this looks like a good reference. 🙂 thanks
n

Nikola Milovic

05/26/2021, 3:12 PM
@Jan M Jetbrains compose sample, the Todo app. Its utilizing MVIKotlin and Decompose. Great resource