Hi everyone! I'm new to KMM and have been looking ...
# kotlin-inject
h
Hi everyone! I'm new to KMM and have been looking to migrate from Dagger/Hilt to kotlin-inject but I've had some difficulty in that I just don't understand the documentation or the samples at all. Does anyone have any more guides on implementation? Thanks!
f
would you mind sharing in more details what you're trying to achieve? are you just basically stuck not knowing how to start? is there any specific aspect of it that is particularly confusing? I feel like your use case might become common eventually (potentially unexperienced in DI migrating from whatever is the default Android DI recommendation) and I'm considering writing a blogpost and going in details about it
h
Well I've been using Dagger/Hilt to provide singletons and binding repositories to inject into viewmodels and interfaces. From what I understand, it's similar to Dagger's component approach, but I suppose with expect/actual and KMM's relaxed project structure, I've been finding it a little confusing on what goes where to make Inject annotations work. I'm honestly assuming it's just my own inability to read documentation that's the real issue.
e
I'll admit the samples don't really cover the KMM usecase well at all which is something that should be improved. The reason for this is I haven't really explored usages more than just getting it working. Def open to pr's on the sample repo related to this. Or if anyone has anything around this they want to share feel free to link!
f
FWIW, I did end up writing about this here (and thanks Eva for the review!), and also submitted a new KMM sample to the samples repo
h
Thanks for the article! I don't understand all of it but it's definitely helped! I'm slowly getting to grips with it. It's mostly trial and error with it, in my case 😅