I was reading this article regarding setting up An...
# koin
m
I was reading this article regarding setting up Android Modules with Koin, and noticed that they do loadKoinModules/unloadKoinModules in Activity onCreate/onDestroy. Is this an unusual way to use Koin? I assumed you just set everything up during
startKoin {}
and then and loading/unloading would be in rather non-standard scenarios (e.g. when there are large components and so need to free up memory). https://medium.com/better-programming/setting-up-android-modules-with-koin-962534395a3e
m
I think the idea is if you have a separate feature module and you want to inject things that are specific to that module and not available in your core app module, then you need to load those at that module’s point of entry (Android library modules, not Koin modules)
I’ve only used Koin with a monolithic app, so doing everything in
startKoin
still works in that case
a
load/unload modules is a convenient way to deal with a global bunch of definitions
I woudn’t recommend to load/unload modules on the fly on each Activity/Fragment, better use the Scope API for that
👍 2