Skip to content
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

Switch from Kodein to Koin #1112

Merged
merged 2 commits into from
Nov 14, 2024
Merged

Switch from Kodein to Koin #1112

merged 2 commits into from
Nov 14, 2024

Conversation

Syer10
Copy link
Collaborator

@Syer10 Syer10 commented Nov 10, 2024

No description provided.

@inverce
Copy link

inverce commented Nov 14, 2024

Why do you prefer using

KoinPlatformTools.defaultContext().get().inject()
instead of simply by inject()
as is prefered in official documentation

Instead of https://insert-koin.io/docs/quickstart/kotlin
For example in AndroidCompat
The default : KoinComponent effectively translates to KoinPlatformTools.defaultCotext(), but looks much clearer

Also since i'm already asking, what is the reason of extra injectLazy instead of simply using default inject extension from insert-koin ?

@Syer10
Copy link
Collaborator Author

Syer10 commented Nov 14, 2024

The default by inject() requires implementing KoinComponent. This is a unnecessary step since the server will only have 1 global context. I see no use to implementing KoinComponent for everything that needs Koin. This is why I prefer injektLazy(), since its basically a utility function that does the same as KoinPlatformTools.defaultContext().get().inject(), but cleaner. I will implement my own utility function that does the same as KoinPlatformTools.defaultContext().get().inject() if/when we remove Injekt down the road.

@Syer10 Syer10 merged commit 0670f29 into Suwayomi:master Nov 14, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants