530 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
72
views
How to intercept Back press in Navigation3 to switch Bottom Navigation tabs?
Body:
I am implementing the new androidx.navigation3 library in my Jetpack Compose project. I am using a custom Navigator class (injected via Koin) to manage the global backStack.
The Architecture:
...
Best practices
0
votes
0
replies
64
views
Providing System Services through DI
I’m using Koin for dependency injection in an Android app, and I want to provide BluetoothManager through DI.
Right now, I have a module like this:
val bluetoothModule = module {
single<...
0
votes
1
answer
66
views
Koin VM/navigation on Kotlin Multiplatform - singleton viewmodel becoming unable to launch coroutine after popBackStack
Maybe I'm doing something wrong but this seems very strange to me took me a while to track down the cause but basically ViewModels are getting corrupted whenusing popBackStack or swipe left, vm's are ...
2
votes
1
answer
145
views
Set up Koin in modularized Android project for Compose previews
I'm setting up an Android project, where I've separated the code into different modules to have a bit of a cleaner structure. The modules are presentation, domain, data, di and app. I am including a ...
1
vote
1
answer
80
views
How to inject Context in a class constructor and in the 2nd constructor as well, using koin?
I have a Builder class in my main class with 2 constructors:
MyClass.Builder(context: Context)
MyClass.Builder(params = params, context = Context)
I am using Koin framework.
And I need to inject ...
1
vote
2
answers
196
views
Lifecycle of ViewModel injected in root composable
I am facing weird behaviour in my application and it's probably because of lifecycle of ViewModel (injected in root composable), but I can't find any information about it in documentation.
Problem:
...
0
votes
0
answers
66
views
Problem using Koin with Ktor and testApplication in unit tests – KoinAppAlreadyStartedException
I'm writing unit tests for my Ktor 2.3.0 application using Koin 3.4.0 for dependency injection and MockK for mocking. I want to test my controllers using testApplication {} from ktor-server-test-host. ...
0
votes
0
answers
39
views
Why is the Koin factory not being called when passed in as parameter to another object with get() and parametersOf()?
I have defined the following repository in a Koin module which requires a parameter:
factory<AdRepository> { params ->
DefaultAdRepository(
inputAdId = params.get(),
...
0
votes
0
answers
178
views
How to inject repository on swift ViewModel on KMP?
I'm doing a project on KMP (UI not shared). I'm writing UI for iOS with SwiftUI.
I have a shared, androidApp, iosApp modules.
In my shared module, I have repositories. I'm doing Dependency Injection ...
0
votes
0
answers
38
views
Koin only injects one feature into Map<Int, Feature> in Kotlin CLI app
I'm building a Kotlin CLI application using Koin. I have multiple Feature classes (each representing a functionality), and I register them as follows:
// FeatureModule.kt
val FeatureModule = module {
...
1
vote
1
answer
70
views
passing context to android platform in kmp project
in my kmp project i want to implement a reminder in android and ios platform .
interface ReminderScheduler {
fun scheduleReminder(reminder: Reminder)
fun cancelReminder(id: String)
}
expect ...
1
vote
1
answer
82
views
Hitting the function arity limit when using Koin's viewModelOf()
In our codebase there is a ViewModel that contains 23 dependencies (I know..) which could be injected just fine with 22 previously through Koin's viewModelOf(::YourVM). After one more was added, we ...
0
votes
1
answer
107
views
Koin NoDefinitionFoundException for Room Database in a Compose Multiplatform Project
I'm working on a Compose Multiplatform project using Koin for dependency injection, Voyager for Navigation and Room for Database Management. I'm encountering a NoDefinitionFoundException when trying ...
1
vote
1
answer
321
views
why is my ViewModel not destroyed when i navigate back from a screen in kotlin multiplatform?
I am using koin and viewodel in my KMP project. I am using
val viewModel = koinViewModel<AddOrEditViewModel>()
to initialize my viewModel. Even when i go back from a screen and go to the same ...
0
votes
2
answers
422
views
How to Properly Initialize Koin in a KMM Application on the iOS Side?
I’m working on a Kotlin Multiplatform Mobile (KMM) application and trying to set up dependency injection using Koin. The Android side works fine, but I’m running into issues when initializing Koin on ...