Koin: Inject to non android classes.

Created on 7 Jun 2018  路  4Comments  路  Source: InsertKoinIO/koin

Thanks to the developers for this library!

Is the ability to do something like this?:

object Logger {
    private val writer: Writer by inject()
    ...
}
core question

All 4 comments

Hello @sankarsana,

just add the KoinComponent interface to your class.

```kotlin
object Logger : KoinComponent {
private val writer: Writer by inject()
...
}
````

So simple!!!
Thanks for the quick response.
I think this should be written in the documentation. Maybe I did not find it?

Current version of the documentation is here: http://insert-koin.io/docs/1.0/reference/koin-dsl/

We are rewriting it for the 1.0

Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leodeleon22 picture leodeleon22  路  4Comments

miladsalimiiii picture miladsalimiiii  路  3Comments

ILAgent picture ILAgent  路  3Comments

AHarazim picture AHarazim  路  3Comments

guymclean picture guymclean  路  3Comments