Koin 4.2.0-RC1
This Release Candidate consolidates all features, improvements, and bug fixes from the alpha and beta series. The focus has been on Compose integration stability, scope resolution improvements, Ktor 3.4 DI Bridge, and compiler plugin support.
Highlights
Ktor 3.4 DI Bridge Integration
- Bidirectional dependency resolution between Koin and Ktor DI - #2294 by @arnaudgiuliani
- KoinDependencyMapExtension implementing Ktor 3.2+'s DependencyMapExtension interface - 00496cc by @arnaudgiuliani
- New KoinKtorApplication DSL for explicit bridging configuration - 53cfc64 by @arnaudgiuliani
- SPI registration for automatic extension discovery
- Ktor 3.4 stable support - 3e5b44c by @arnaudgiuliani
Navigation 3 Support
- New koin-compose-navigation3 module for AndroidX Navigation3 1.0.0 - #2302 by @arnaudgiuliani
- EntryProvider API for scoped dependency injection in navigation destinations
- Metadata parameter passing support (animations, etc.) - 7fbab5e by @arnaudgiuliani
- Make nav3 EntryProvider generic - #2314 by @xephosbot
Compose Improvements
- koinActivityInject() function for Activity scope dependency retrieval - f946362 by @arnaudgiuliani
- UnboundKoinScope API with @KoinDelicateAPI annotation - f38a30f by @arnaudgiuliani
- Fixed premature release of scope & context in onForgotten - #2326 by @arnaudgiuliani
- Fixed Compose Koin Context Loader and Entry Points - #2327 by @arnaudgiuliani
- Navigation 2.x scope support (KoinNavigationScope) - #2309 by @arnaudgiuliani
- Compose context internals migration helpers - #2295 by @arnaudgiuliani
ViewModelScope Updates
- ⚠️ Breaking ⚠️: ViewModel declarations requiring scope injection must now be inside viewModelScope { } block
- Improved CoreResolverV2 for proper child scope/ViewModel scope resolution - #2340 by @arnaudgiuliani
Koin Compiler Plugin Support API
New internal APIs for Koin Annotations compiler plugin:
- ModuleExt, CreateDSL, BaseDSLExt, ApplicationDSLExt - 932c154 by @arnaudgiuliani
- ViewModelDSLExt / ViewModelModuleExt - 43ecac9 by @arnaudgiuliani
- WorkerDSLExt / WorkerModuleExt - 43ecac9 by @arnaudgiuliani
- Adjusted KoinApplication.withConfiguration() API support - c4a5dcb by @arnaudgiuliani
Core Improvements
- strictOverride option + explicit definition override support - #2304 by @arnaudgiuliani
- Lazy modules loading performance improvement (parallel loading at start) - #2303 by @arnaudgiuliani
- Performance optimization for scope resolution & thread safety - #2330 by @arnaudgiuliani
- Optimized ThreadLocal loading to avoid cost per Scope - #2345 by @arnaudgiuliani
- getAll() now returns instances in declaration order (removed default sorting) - 74d9884 by @arnaudgiuliani
- Kotlin 2.2.20 update - #2278 by @nhajratw, #2296 by @arnaudgiuliani
Bug Fixes
- Fixed scope resolution issues - #2324 by @arnaudgiuliani
- Fixed CoreResolution with Child Scopes / ViewModelScope - #2340 by @arnaudgiuliani
- Fixed CoreResolverV2 stack params propagation - #2341 by @arnaudgiuliani
- Fixed sharedKoinViewModel with type-safe navigation routes - #2293 by @nazaburo
- Fixed WASM qualified name resolution - #2344 by @arnaudgiuliani
- Fixed module flatten order error - #1999 by @luozejiaqun
- Fixed crashing declarations for LocalKoinScope & LocalKoinApplication - 261bf93 by @arnaudgiuliani
- Fixed Qualifier conversion in Ktor DI bridge - 90edf60 by @arnaudgiuliani
- Safer ScopeFactory protecting all operations from parallel calls - #2323 by @arnaudgiuliani
- Fixed nav3 metadata arguments - #2313 by @arnaudgiuliani
- Fixed Scope Archetypes Qualifier in plugin support functions - f972c52 by @arnaudgiuliani
- Fixed scope resolution in plugin - 01cff0d by @arnaudgiuliani
- Fixed EAP Access Ktor - f6a5040 by @arnaudgiuliani
Dependencies
- Kotlin 2.3.20-Beta1
- Ktor 3.4.0
- Coroutines 1.10.2
- Compose Multiplatform 1.10.0
- AndroidX Lifecycle 2.10.0 / JetBrains Lifecycle 2.9.6
- AndroidX Navigation 2.9.6 / JetBrains Navigation 2.9.1
- AndroidX Navigation3 1.0.0
New Modules
- koin-compose-navigation3 - Navigation 3 integration
- koin-annotations - Core annotations module
- koin-dagger-bridge - Dagger to Koin bridge
Removed
- koin-fu module (moved to Koin Annotations plugin) - 932c154 by @arnaudgiuliani
- CHANGELOG.md (see GitHub releases) - #2308 by @jvanderwee
Breaking ⚠️
- ViewModel Scope Constructor Injection (still experimental) - ViewModel declarations requiring scope injection must now be declared inside viewModelScope { } block
Contributors
Thanks to all contributors: @arnaudgiuliani, @nhajratw, @egorikftp, @GrzegorzBobryk, @jvanderwee, @xephosbot, @nazaburo, @luozejiaqun
Full Changelog: 4.1.1...4.2.0-RC1