Koin Annotations 2.0 — Release is out!

Arnaud Giuliani on 2025-02-28

Koin Annotations 2.0 — Release is out!

A new major milestone for Kotlin Dependency Injection and Multiplatform!

Hello dear Koin community 👋

Unboxing Koin — OpenAI generated

TL;DR:

Koin Annotations 2.0 is a major update for Kotlin dependency injection. Featuring a compiler rework with better stateless pass management — part of our KSP2 compatibility work — the update delivers a safer code extraction and generation engine that flawlessly handles annotation order and a reworked safety engine, ensuring smooth operation with both KSP1 and KSP2 and maximum speed. It brings multi-module support with @ComponentScan extended capacity and package expressions, full Kotlin Multiplatform compatibility, and some impressive benchmarks. This release is powered by Google KSP 2.0.21-1.0.28, Kotlin 2.0.21, and Koin 4.0.2.

The evolution of Kotlin dependency injection has reached a major milestone with the launch of Koin Annotations 2.0. Designed from the ground up to meet the demands of modern, Kotlin multiplatform development, this release consolidates how annotations are handled in Kotlin projects. With a focus on efficiency, safety, and scalability, Koin Annotations 2.0 leverages a complete compiler rework to ensure that your projects are built faster and more reliably than ever before. Whether you’re working on large-scale multi-module applications or targeting both shared and native platforms through Kotlin Multiplatform, Koin Annotations 2.0 is built to handle it all with ease.

All release details can be found on Github: https://github.com/InsertKoinIO/koin-annotations/releases/tag/2.0.0

What’s New in Koin Annotations 2.0

Stateless Pass Management & Compiler Rework

Benchmark Performance: The system can automatically split large definitions files as needed, and benchmarks demonstrate that generating and verifying 1650 definitions takes roughly 3 seconds.

Based on stable Kotlin stack:

Based on latest stable Kotlin stack:

Here’s what you can expect:

Using our VM in Compose

Example: Inject your ViewModel in a Compose Multiplatform project.

Modules and Component Scanning

Scanning for packages in more advanced way
commonMain Component
Android native component
iOS Native Component
Just starting the Koin module, with .module class extention

Example: Just start your module with the generated .module extension!

Performance and Safety

Try out our getting started projects:

Upgrade now to harness the power of Koin Annotations 2.0 and experience next-level performance and flexibility in your projects.

Let us know what you think about this new release on koin slack channel or on twitter✌️