Once you have declared some modules and you have started Koin, how can you retrieve your instances in your Android Activity Fragments or Services?
Activity, Fragment & Service as KoinComponents
Activity, Fragment & Service are extended with the KoinComponents extension. You gain access to:
by inject()- lazy evaluated instance from Koin container
get()- eager fetch instance from Koin container
For a module that declares a 'presenter' component:
We can declare a property as lazy injected:
Or we can just directly get an instance:
Need inject() and get() anywhere else?
If you need to
get() an instance from another class, just tag it with