Hey folks! I'm running into a problem and could us...
# multiplatform
s
Hey folks! I'm running into a problem and could use some help. So, I’ve created a Kotlin Multiplatform project that consists of multiple modules. Each of these modules provides specific features and acts as a library for the main module. Now, I’m facing some difficulties and I’m not sure how to solve them. Let me explain the issue in detail. 1) mobileApp / src / androidMain - com.kmp.connect / commonMain - com.kmp.connect / iosMain - com.kmp.connect 2) composeAppTheme - Design system implementation 3) discoverDevices / src / commonMain - com.kmp.discover __
Expect.kt
It it possible to provide an actual implementation from each target?
e
… from each target in … • in
mobileApp
- no • in
discoverDevices
- yes, you need to define the same sourceSets as in
mobileApp
in your build file. From that point I believe the IDE should suggest to you to implement the `actual`s when your cursor is on your expect API
s
Well but do you think I'll able to then use the source code inside Expect.kt into commonMain of
mobileApp?
If i'v declared it as dependency for mobileApp?
e
You can use the expect API you declared but you also need actual declarations beside it
s
Do you have any example available on the internet which I can refer to because I'm not really being able to implement it.
a
You can check this project https://github.com/phansier/Coffeegram And a small diagram for easier finding modules you need: https://gist.github.com/phansier/45bf7daa5c1701ef9f741f1edae9091e
s
Hey thanks man! This is really helpful. 😁