ianbrandt
10/21/2019, 12:18 AMKoinComponent.get() expects the type to be known at the call site. It turns out Koin does have lesser documented get() API via KoinComponent.getKoin() that isn't inlined and takes a KClass. If anyone is interested, here is how I got it to work:
FX.dicontainer = object : DIContainer, KoinComponent {
override fun <T : Any> getInstance(type: KClass<T>): T {
return getKoin().get(clazz = type, qualifier = null, parameters = null)
}
}
Full example here: https://github.com/ianbrandt/tornadofx-test/blob/ef59dc55d33e1d28602b0dcf939bd8f5811fb53d/koin/src/main/kotlin/com/ianbrandt/tornadofx/koin/KoinApp.kt