https://kotlinlang.org logo
#android
Title
# android
a

amichalski

09/10/2017, 8:44 PM
I'm looking for some good tutorial or github code about Dagger 2 for Android app written in Kotlin
K 1
r
Take a look mine.
e

edwardwongtl

09/11/2017, 3:00 AM
I think you can take a look at
Kodein
, it is a better DI library for Kotlin
4
2
m

mate.herber

09/11/2017, 7:26 AM
not compile time validated tho
g

gildor

09/11/2017, 7:51 AM
Kodein and Dagger are very different. And Kodein actually not a DI at all, but service locator
💯 1
s

sanogueralorenzo

09/11/2017, 7:51 AM
@edwardwongtl Do you have an example project? Dagger is quite handy with @Inject constructor in kotlin
r

radityagumay

09/11/2017, 7:52 AM
take a look my repo
g

gildor

09/11/2017, 7:54 AM
This repo from @kboyarshinov that contains some advanced examples of Dagger usage for Android App based on dagger-android https://github.com/kboyarshinov/advanceddagger2
s

sanogueralorenzo

09/11/2017, 7:57 AM
I was asking for Kodein example since I've only played around with it 😄
e

edwardwongtl

09/11/2017, 8:00 AM
I don't have an example project in hand by now, but you can take a look at Kodein's page to get a feel of how to use it. https://salomonbrys.github.io/Kodein/
And i think dagger2 has too much boilerplate code, maybe the cause is dagger is designed with&for java in the first place. Just a personal feel, no offense. 😀
s

sanogueralorenzo

09/11/2017, 8:08 AM
I already had a look at those, was looking more for a mvvm mvp example with the different layers in place
I felt the same about dagger but when I found out about @Inject constructor I got rid of most of the boilerplate
e

edwardwongtl

09/11/2017, 8:46 AM
But still creating a bunch of
@Provide
,
@Module
and `@Component`class & interface is too verbose for me, however dagger2 does allow easy unit testing...
r

radityagumay

10/01/2017, 11:17 AM
@edwardwongtl yes. dagger using annotation processor then create a generate code based on that annotate.
i dont know, if you can achieve such ways without annotate.
2 Views