Open OKatrych opened 2 months ago
The only working way how to have implementations in native source sets is to define expect
class for it:
internal interface IFirebaseAppCheckTokenProvider {
suspend fun getToken(): Result<String>
}
@Single(binds = [IFirebaseAppCheckTokenProvider::class])
internal expect class FirebaseAppCheckTokenProvider
and then in native sourceSets:
@Single(binds = [IFirebaseAppCheckTokenProvider::class])
internal actual class FirebaseAppCheckTokenProvider : IFirebaseAppCheckTokenProvider {
// impl logic
}
But I feel there should be an easier way to do this, and I'm missing something.
You seems to enforce bind type binds = [IFirebaseAppCheckTokenProvider::class]
, right?
Did you take a look at this sample here? https://github.com/InsertKoinIO/KMP-App-Template?tab=readme-ov-file#sharing-multiplatform-native-components
Describe the bug I have the KMP network module with structure like this:
ComponentScan is enabled for the entire module:
commonMain
holds the interface:That is implemented in
androidMain
andiosMain
sourceSets:For some reason, I'm getting the "Missing Definition type" error:
When looking into the generated code, I see that, indeed,
commonMain
doesn't contain theIFirebaseAppCheckTokenProvider
definition butandroid/ios
does have a complete generated module withIFirebaseAppCheckTokenProvider
inside it.commonMain:
android:
What would you suggest to do in this case to make KOIN_CONFIG_CHECK work?
Koin project used and used version (please complete the following information):
koin-core version 3.5.6
koin-annotations version 1.4.0-RC4