Koin 0.9.1 — Bug fixes, improvements & bug fixes ⚒

Hello Koin users! Here is the first fix of the 0.9.x version, bringing some fixes and improvements to help you, in your daily use Koin. Thank you for your feedback. As you may see in the changelog, lots of points come from issues and PR from the community. Let’s go 👍


Don’t forget to update your package as well:

compile "org.koin:koin-core:0.9.1"
compile "org.koin:koin-android:0.9.1"
compile "org.koin:koin-android-architecture:0.9.1"
...

We continue here to improve the koin-android-architecture API on the following point.

Clearer ViewModel API

Since we have launched this API, we have seen that ViewModel instance sharing can be confusing. Now we have updated our API with following:

  • getViewModel() / by viewModel() — create an instance for given Activity or Fragment
  • getSharedViewModel() / by sharedViewModel() — allow a Fragment to share a ViewModel with its Activity.

We don’t have to use any “fromActivity” parameter anymore to force instance creation for Fragment.

Android eager injection

Our koin-android module now offers the possibility to directly/eagerly get a Koin dependency, with the get() function. Our advice is to prefer lazy property definition, which allows lazy injected values with by inject():

Use the get() function for more local/specific actions and if you don’t need to keep your dependency in a class property.

Dynamic parameters now functional

Introduced in 0.9.0, parameters are a good way to push runtime values to your definition. The previous version required that all your values were already evaluated which was not very convenient for the situation such as passing Android runtime data.

Now just declare your parameters in a lambda like this:

And your parameters will be lazily evaluated for your Koin bean definition. We don’t need to fill parameters in “parameters” parameter from inject() anymore.

Propagate dynamic parameters

You can now propagate parameters between definitions:

The get() DSL function can now embed parameters to propagate. Use it with lambda.

Important Core fixes

Bunch of fixes have been done on the core part, fixing regression on stack resolution, error logs, and properties loading from external files. if you were using Koin 0.9.0, don’t hesitate to update to 0.9.1.

README & Website cleanup

Our website https://insert-koin.io has been cleaned. We have fixed our embedded search engine. We continue to feed up README.md & CHANGELOG.md.


We are in maintenance of the 0.9.x branch version of Koin. We won’t plan any new feature, as we estimate that have reached an interesting amount of features and API. We want to stabilize Koin as well 🚑.

We are on the road to stable 1.0 ⚒. Any new feature will be planned after 1.0 on the new roadmap. Hope you’ll enjoy this new version 🙂