Ryan Simon
04/27/2021, 11:58 PM:core
and one module called :auth
. :auth
depends on :core
.
I also want a Koin setup where :auth
and :core
Koin dependencies can be initialized on each client app. this would allow me to share a network implementation from each client across both modules
the problem is that when trying to setup the Koin dependencies on iOS, each module has its own version of the Network
interface. :auth
refers to it as AuthCoreNetwork
and :core
refers to it as CoreNetwork
. with this in mind, we can't properly setup the Network
dependency as the interfaces are incompatible
this setup works fine on Android side, but not on iOS.
any idea what I could do to solve for this, if anything? code sample of what I'm trying to do on the iOS side below
func startKoin() {
NSLog("Hi")
let doOnStartup = { NSLog("Hello from iOS/Swift!") }
let network = NetworkManagerImpl()
Core.KoinIosKt.doInitKoinIos(doOnStartup: doOnStartup, network: network)
Auth.KoinIosKt.doInitKoinIos(doOnStartup: doOnStartup, network: network) // doesn't work because the network instance doesn't match up
}
xxfast
04/28/2021, 11:31 AMpackForXCode
implicitly fix all public api of a module with the name of the module itself - causing this incompatibilityrusshwolf
04/28/2021, 12:37 PMRyan Simon
04/28/2021, 4:48 PMrusshwolf
04/28/2021, 5:33 PMRyan Simon
04/28/2021, 5:36 PMrusshwolf
04/28/2021, 5:40 PMexport()
declarations in your framework if you need to talk to kotlin dependencies from Swift, and/or add transitiveExports = true
. The other change is that transitive dependencies will have the module name prefixed when they reach Swift.Ryan Simon
04/28/2021, 8:58 PMxxfast
04/29/2021, 12:28 AMapi
on the lib-module.
:core
sourceSets {
val commonMain by getting {
dependencies {
api(InsertKoin.koinCore)
...
}
}
}
and
:login
ios {
binaries {
framework {
export(project(":core"))
baseName = "Login"
}
}
}
https://kotlinlang.org/docs/mpp-build-native-binaries.html#export-dependencies-to-binariesRyan Simon
04/29/2021, 3:24 PM