Skip to content

Koin 3.5.4 Release Note

We're excited to announce the release of Koin 3.5.4, which introduces a suite of enhancements, documentation updates, and critical bug fixes aimed at optimizing dependency injection in Kotlin. We thank all the Koin contributors who continue to help make these updates possible πŸ™ 

Koin 3.5.4 Release Note
Koined image from Hal Gatewood

Koin is the Kotlin integration framework that offers seamless compatibility with Kotlin Multiplatform (KMP) and Compose Multiplatform and continues to support the development of cross-platform applications by offering a consistent dependency injection solution across all platforms.

So What's New? Key Enhancements and Features

🐘 Gradle Plugin Improvements

The enhancement of the Gradle Nexus Publish Plugin aims to streamline the process of publishing artifacts to Nexus repositories. This upgrade offers significant benefits if you're seeking to automate and simplify your build and release pipelines, reducing the chances of manual errors. With improved plugin support, integration with Gradle tasks is seamless, providing a smoother experience when publishing Kotlin modules. The focus on enhancing security and managing staging repositories marks a pivotal improvement in the project's workflow. By adopting this plugin, Koin now enjoys enhanced handling of artifacts destined for Maven Central, ensuring efficient and reliable releases. This update aligns with Koin's ongoing efforts to modernize and optimize development practices.

πŸ“Ž Koin Documentation: Now Polished for Your Reading Pleasure 😜

We've attempted to enhance the Koin documentation, focusing on refining instructions, improving terminology consistency, and enhancing overall clarity and readability. This documentation update attempts to provide you with precise and comprehensive guidance on effectively injecting Koin into your projects, ensuring that the documentation is not only precise but also user-friendly and easily accessible.

And, after a hiatus, the feature allowing you to directly edit documentation on the website has been reinstated!

This is in the spirit of fostering a collaborative ecosystem and enriching the resources available to you.

🎱 Bill of Materials (BOM) Update

In Koin 3.5.4, we've addressed a documentation gap with the addition of a Koin Bill of Materials (BOM) guide. This update offers a detailed explanation of using the Koin BOM for effective dependency management, advocating for the implementation platform("io. insert-koin:koin-bom:$koin_bom") approach to consolidate library version control, thereby obviating the need for specifying versions of individual Koin dependencies. This streamlines project configurations and simplifies the upgrade process within the Koin ecosystem. 

πŸ“š Library Updates: Critical Stately-Common Upgrade

This release addresses a particularly thorny issue that has been the bane of many developers' existence: the stately-common transitive dependency conflict. This conflict, notably causing headaches in projects leveraging SQLDelight within Kotlin Multiplatform Mobile (KMM) environments, was spotlighted when our awesome community members stumbled upon and reported unexpected behavior during project setups. The root of the problem was traced back to a clash with stately-common, a scenario detected by the community. We've resolved this issue by updating of stately-common to version 2.0.6. With this update, you can now dive into your KMM projects with renewed confidence, and enjoy a more streamlined project setup and maintenance process.

Corrections to the coroutine engine dispatcher APIs and fixes addressing iOS concurrency issues with Stately collections mark a significant step towards achieving seamless cross-platform performance. Moreover, modifications to the Maven Koin-test dependencies and the resolution of JVM-dependent issues are aimed at bolstering the testing framework, guaranteeing you possess a dependable set of tools to validate your application.

🍏iOS Stability by Resolving Concurrent Modification Challenges

In Koin 3.5.4, an issue causing ConcurrentModificationException on iOS with Kotlin 1.9.20 and later was addressed. This exception occurred during the stopKoin() process in environments with multiple scopes, due to concurrent modifications of a hashmap while iterating over scopes in the closeAllScopes() function, which was not thread-safe on iOS. We implemented a solution that involves the use of stately collections to ensure thread-safe operation of collections on the native iOS side, effectively preventing the exception by modifying the scope closing mechanism. This included creating a snapshot of the collection before iteration, a change that allowed for safe iteration, and modification of scope collections.

πŸ—οΈ ViewModel Management: Key Generation 

The Koin 3.5.4 release has brought advancements in ViewModel handling within the Koin framework, specifically addressing key generation and scope handling for ViewModels. This update focuses on two main enhancements:

  • ViewModel Key Generation: The mechanism for generating ViewModel keys has been refined to calculate keys based on both Key and/or Qualifier. This improvement ensures a more accurate and reliable identification process for ViewModels, preventing unnecessary recreation and facilitating smoother state management.

Additionally, the introduction of ScopeViewModel (experimental Koin API) provides you with a structured approach to managing ViewModel scopes. This feature allows for the encapsulation of scoped dependencies directly within a ViewModel, exemplified by the following module definition:

Screenshot 2024-03-12 at 16.35.47These updates not only streamline the development process by ensuring more granular control over ViewModel lifecycle and dependencies but also contribute to the overall robustness of applications by preventing common issues related to scope management and memory leaks. We've updated the documentation to reflect these changes, offering clear guidance on implementing these new features in Android applications developed with Koin.

πŸ”§ Other Fixes:

A series of miscellaneous fixes, including corrections to documentation links and the inclusion of guidance around ClosedScopeException cases, have been implemented. These adjustments are geared towards improving the developer experience by providing clearer pathways through potential challenges and enhancing the overall stability and usability of Koin.

The release of Koin 3.5.4 represents a significant milestone in our mission to deliver a dependency injection framework that is both powerful and easy to use. By addressing key areas such as Gradle plugin integration, documentation clarity, library updates, and testing enhancements, we continue to refine and advance Koin, ensuring it remains a leading choice for Kotlin developers seeking efficient, scalable solutions for their projects.

We invite you to explore the new features, integrate them into your development workflow, and share feedback to help us continue improving Koin. Your contributions and insights are invaluable as we strive to make Koin the go-to framework for Kotlin dependency injection.

Embrace the new capabilities of Koin 3.5.4 and elevate your Kotlin projects to new heights πŸ”₯

We've also updated a bunch of dependencies to their latest stable versions:

  • kotlin 1.9.22
  • jetpack compose 1.5.10
  • JetBrains compose 1.5.12
  • ktor 2.3.9


Koin 3.5 Release Note