Describe the bug
Declare an interface, implementing in Swift, then inject by calling the function
interface ZipUtil {
fun unzip(sourcePath: String, destinationPath: String): Boolean
fun compress(sourcePath: String, destinationPath: String): Boolean
fun getZipEntryList(zipFilePath: String): List<Pair<String, Boolean>>
fun getZipEntryContent(zipFilePath: String, entryName: String): ByteArray?
}
fun KoinApplication.initIOSKoin(
di: List<Any>,
) {
val zipUtil = di.find { it is ZipUtil } as? ZipUtil
val photoUtil = di.find { it is PhotoUtil } as? PhotoUtil
modules(
module {
zipUtil?.let { single<ZipUtil> { zipUtil } }
photoUtil?.let { single<PhotoUtil> { photoUtil } }
}
)
}
> Task :composeApp:compileKotlinIosSimulatorArm64 FAILED
error: [Koin] Missing definition: com.mrl.pixiv.common.util.ZipUtil
Required by a call site in a dependency module (deferred validation).
No matching definition found in any declared module.
Check your declaration with Annotation or DSL.
error: [Koin] Missing definition: com.mrl.pixiv.common.util.PhotoUtil
Required by a call site in a dependency module (deferred validation).
No matching definition found in any declared module.
Check your declaration with Annotation or DSL.
[Koin] Missing definition: com.mrl.pixiv.common.util.ZipUtil
Expected behavior
Methods that support dynamic injection in 4.2.0 and above
Koin project used and used version (please complete the following information):
koin-core version 4.2.0
koin-annotations version 4.2.0
Additional moduleDefinition
Add any other moduleDefinition about the problem here.
Describe the bug
Declare an interface, implementing in Swift, then inject by calling the function
Expected behavior
Methods that support dynamic injection in 4.2.0 and above
Koin project used and used version (please complete the following information):
koin-core version 4.2.0koin-annotations version 4.2.0Additional moduleDefinition
Add any other moduleDefinition about the problem here.