-
Notifications
You must be signed in to change notification settings - Fork 4
Feature/hilt to koin #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/hilt to koin #179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the dependency injection framework from Hilt to Koin to support Kotlin Multiplatform (KMP). The migration removes Hilt annotations and modules while introducing Koin modules with a cleaner, more centralized configuration approach.
- Replaces Hilt ViewModels and @Inject constructors with Koin equivalents
- Introduces value classes for configuration parameters to replace Hilt qualifiers
- Adds comprehensive Koin module verification tests
Reviewed Changes
Copilot reviewed 43 out of 44 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| gradle/libs.versions.toml | Updates dependencies, removes Hilt, adds Koin libraries |
| feature//ui/.kt | Replaces hiltViewModel() calls with koinViewModel() |
| feature//presentation/.kt | Removes @hiltviewmodel and @Inject annotations from ViewModels |
| **/di/*.kt | Replaces Hilt modules with Koin modules using DSL syntax |
| core/utils/config/ConfigModels.kt | Introduces value classes to replace Hilt qualifier annotations |
| app/src/test/kotlin/.../KoinCheckModulesTest.kt | Adds test to verify Koin dependency graph integrity |
| app/MainActivity.kt | Replaces @androidentrypoint and @Inject with Koin's inject() |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
core/ui/src/main/kotlin/nl/q42/template/ui/presentation/SnackbarPresenter.kt
Show resolved
Hide resolved
core/navigation/src/main/kotlin/nl/q42/template/navigation/di/NavigationModule.kt
Show resolved
Hide resolved
core/network/src/main/kotlin/nl/q42/template/core/network/di/NetworkModule.kt
Show resolved
Hide resolved
core/ui/src/main/kotlin/nl/q42/template/ui/compose/MainCoroutineScope.kt
Show resolved
Hide resolved
core/ui/src/main/kotlin/nl/q42/template/ui/di/PresentationModule.kt
Outdated
Show resolved
Hide resolved
|
Thanks for the very sharp review @sebaslogen . I've made some changes. |
sebaslogen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems complete for me, only one tricky koin question still open
Since Hilt doesn’t support KMP, we’d like to migrate to Koin instead.
As a bonus, Koin also provides a simpler experience for developers.
As a con, you don't have compile time safety, but do have test-time safety.
I decided not to use Koin annotations, as they tend to decentralize the dependency logic and introduce various workarounds to make things function correctly. In practice, Koin annotations makes the setup more complex and scattered rather than streamlined.
Please also note the unit test that validates the dependency injection graph at test-time.