Advanced multi-platform dependency injection with Kotlin
Dependency Injection is a complicated topic, and when used in a project that compiles to multiple targets through different compilers & runtimes, it can lead to serious headaches. However, the Inversion of Control pattern brings a lot of architecture features and safety.
In this talk, we will see how to use all the power of Kodein-DI, a popular dependency injection library that works everywhere Kotlin can compile to, in a mobile multi-platform project targeting Android, iOS and the mobile Web.
We will start by using the dependency injection pattern to abstract and test the behavior of multi-platform business modules. We will then see how to debug common dependency management errors.
In a second part, we will abstract & test behavior by embedding the DI library into popular behavior architecture patterns, such as MVP, MVVM or MVI, before showing how it can be implemented on each targeted platform.
Finally, we will enhance our common code using advanced features of Kodein-DI such as set bindings, lazy access, context, and scopes.