Repository navigation
Replies: 1 comment
|
This is about the receiver of the extension, rather than a Desktop limitation.
inline fun <reified T : Any> KoinComponent.get(...): TAn import makes the extension visible, but it still needs a import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
class DesktopController : KoinComponent {
private val prefs: AppPrefs by inject()
}Alternatively, if you already have the Koin instance, resolve directly from it without implementing the marker interface: val prefs: AppPrefs = appKoin.get()Here The Java-facing One context caveat: This is checked against the current implementation, not a build of your desktop project. |
Uh oh!
There was an error while loading. Please reload this page.
I'm using Kotlin Multiplatform with Koin to develop a desktop app and wonder why I have to use the
getfunction fromKoinJavaComponentpackage that takes a Java class as an argument:I was hoping I could use the standard
org.koin.core.component.getwithout a parameter but that doesn't seem to get resolved in my module targeting Java Desktop. Could someone explain to me why that is, please?All reactions