https://kotlinlang.org logo
#kotlin-inject
Title
# kotlin-inject
h

Harnick

03/06/2023, 6:25 PM
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

fred

03/07/2023, 1:00 PM
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

Harnick

03/11/2023, 12:42 PM
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

evant

03/12/2023, 12:49 AM
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

fred

03/21/2023, 12:37 PM
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

Harnick

03/30/2023, 11:41 PM
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 😅
16 Views