Most Koin videos I've seen were like "here I show you a project with Dagger and migrate to Koin" or "You add this, this and this and voila, it works". But your video was exactly what a tutorial must be: explaining things step by step and made me understand it. Thank you!
When you say, "most people overcomplicated", it reminded me of the old dagger documentation which gives the thermosiphon example 😃 Nice video btw, thanks!
I'm looking into Koin after just getting really frustrated with Dagger Hilt and wow this is much easier and more flexible than hilt is. Time to migrate to Koin!
I only used Hilt before but definitely gonna try this. The idea of inject at runtime is very interesting! However Hilt is backed by Google though, this is not a fair fight 🙂
@@D3vCansado You will be surprised how many times I saw these "very simple test cases" not implemented and caused prod bugs. Especially after 2 years and 4 dev changes. This is why I prefer compile time over run time. I also need to say that Dagger series was kinda hard to use compared to Koin but I feel using Hilt almost easy as Koin.
@@D3vCansado There are always issues. This is why I don't want to introduce another possible problem. Pipelines, health checks, security checks fails time to time and they might be ignored to deliver prod on time. (They always say they will see at regression/sanity checks if there is a problem) On the one hand, there are tests that I need to trust, and on the other hand, the direct error I will get while doing development. For me it is a clear choice. Anyway, I'm happy that there is more than one DI library. So we can use the library that suits us best.
But viewmodel keyword in Koin acts as a factory? And if we want to share the VM in two fragments por example, can we use viewmodel injection like a singleton?
Hello sir, I am confuse right now my plan is to learn Android development but when I see there are too many videos on the youtube and Fb groups peopls are doing with Flutter right now , ma aim is to get a job in android development can you please guid me what i do , should I need to start with the Kotlin programming or start as a Flutter , I want to do a Job in Android Development. plz answer my question.
Before Dagger Hilt I used to work with koin. It was my first DI library. Then I tried Dagger Hilt and I liked it more))) Hilt was more easier for me to get used to it. Maybe I prefer annotation processing over DSL))
When you are creating a Library, we can't use HILT for dependency injection as we can't force the consumer to integrate HILT in their project. I believe then KOIN is life saviour.
Koin isn't dependency injection actually. It's a service locator. The end result is pretty much the same, both provide dependency, however they do it differently and hilt does it much faster, because it's done at compile time. In other words Koin has no build time impact, but has a runtime one. The opposite is true for hilt.
What if my adapter looks like this RouteAdapter(val clickCallback: (Route) -> Unit Then we are creating what inside module? :D and what if my repository looks like this class Repository( private val routeApi: RouteApi, private val RouteCacheDataSource: RouteCacheDataSource ) and my koin need this 2 dependency? ^^ just we have to use Repository(get(), get()) ?: P
"Single, but I'm not talking about the life of a programmer" 🤭 ... 🤔 🥺🔫 Looks like KOIN might be a little easier to setup than Dagger/Hilt. Not that that's difficult but there is a series of things you need to setup to use it. May check out KOIN for my next project thanks for showing it big 🐕
Philipp - I am trying to use mockito to mock an object that is passed as an argument to the constructor of myViewModel(val dice:Dice). within the Dice class I just have a single method called roll() that just returns a random number between 1..6. It is not It is not returning 3? This is how my instrumentation setup: @Before fun init(){ stopKoin() diceMock = mock(Dice::class.java) `when`(diceMock.roll()).thenReturn(3) val testModule = module { single { diceMock } viewModel{ DiceViewModel(diceMock) } } startKoin{ // loadKoinModules(testModule) modules(testModule) } } @Test fun roll_displaysNumber() { `when`(diceMock.roll()).thenReturn(3) onView(withId(R.id.button)).perform(click()) onView(withId(R.id.textView)).check(matches(isDisplayed())) }
Most Koin videos I've seen were like "here I show you a project with Dagger and migrate to Koin" or "You add this, this and this and voila, it works". But your video was exactly what a tutorial must be: explaining things step by step and made me understand it. Thank you!
A couple of weeks ago I was hoping that you would make a tutorial on Koin and you did. Thank you 😁
When you say, "most people overcomplicated", it reminded me of the old dagger documentation which gives the thermosiphon example 😃
Nice video btw, thanks!
Really helpful, I was unaware of how to handle named injection like Hilt. Thanks
I'm looking into Koin after just getting really frustrated with Dagger Hilt and wow this is much easier and more flexible than hilt is. Time to migrate to Koin!
my takeaway from the video 12:24 - single{
} // is life of a programmer XD
I almost fell of my chair :D
Lmao 😂😂
Just the video I was needing. Thank you!
It's really helpful. Thanks Lackner
Clear explanation. Thanks philipp
I only used Hilt before but definitely gonna try this. The idea of inject at runtime is very interesting!
However Hilt is backed by Google though, this is not a fair fight 🙂
Just because it has the Google badge, doesn't mean it's good😅
For hilt though, I agree 😁
Simplicity vs Complexity. Single platform vs Multi platform. Koin is both simple to use and work with Kotlin Multiplatform Mobile.
Don’t worry give it time. It will be retired like everything else
@@Joey-ni8kh ^^ this ^^
Koin being an easy to use service locater without any proxies, code generation or reflection can attract many people.
It uses reflection
Great video as always keep it up!!!! Love you!
this is such a nice video. Thanks Philipp.
Thank you for the video , very helpful
Thanks a lot Philipp for your guide, really great work 🙏
I worry about you, how you provide such great contents for free? Thank you so much sir.
Do not worry about Philipp he is a gigachad
Excellent tutorial bro - very relevant..
Philipp can you make a tutorial about savedStateHandle? How and when to save data and how to retrieve? Thank you.
U r gr8 like always keep going up thank you. Single joke was good😅. Can you tell savedstatehandle with koin pls
Very cool video
thank you bro wish you all the best 👍👍👍🔥🔥🔥🔥
Nice explanation! THX
Wow you make it very understandable. Thank you
Philipp actually dropped a joke on 12:23 🤣
Thanks for making this video.
12:25 EMOTIONAL DAMAGE !
which one that you most recommend Koin or Hilt?
@Houssem Zaier nice simple answer bro
Could you do a video on baseline profiles, looks like a great way to increase app start performance
Interesting. it looks so simple.
With you i learn Android and english :D
Hey, Phillip. Chapters would be clutch for this video.
Hey! Great video :D Can you do any tutorials on Anvil? It seems the community is really lacking some solid examples of its usage.
Ko-een 😂
I love to watch your videos 😍
Where did you get all these dependencies from? I didn't see them in the documentation I found online.
Could you pls upload a video with paging and how we can implement it with Resource class
Wow man. Respect.
Ty for this video!
Nice...reminds me.
.have you done KTOR?
I need to review your library again
He's got a bunch of KTOR videos
this is awesome! QQ: what if in the viewmodel constructor we need 2 or more dependency? how we inject that dependency? thanks
Thank you so much!
Thank you for your awesome contents.
Thanks a lot. 😊
so which one is good hit or koin?
I always find DI at runtime kinda dangerous. When you have multiple flow, it is easy to miss one and you will only notice when running it.
Koin for small apps.
Hilt/Dagger for big apps.
@@D3vCansado You will be surprised how many times I saw these "very simple test cases" not implemented and caused prod bugs. Especially after 2 years and 4 dev changes. This is why I prefer compile time over run time.
I also need to say that Dagger series was kinda hard to use compared to Koin but I feel using Hilt almost easy as Koin.
@@D3vCansado There are always issues. This is why I don't want to introduce another possible problem. Pipelines, health checks, security checks fails time to time and they might be ignored to deliver prod on time. (They always say they will see at regression/sanity checks if there is a problem)
On the one hand, there are tests that I need to trust, and on the other hand, the direct error I will get while doing development. For me it is a clear choice.
Anyway, I'm happy that there is more than one DI library. So we can use the library that suits us best.
what color theme is that?
single : when i write that i don't want to talk about the life of the programmer, that actually means singleton 😂
Can you make a video about the mavericks framework?
What about preview? How to organise preview with viewModel and Koin? ay be a good them for video)
12:24 single 🤣
Something hilarius happened before he make the video, bc he spent all the video trying to avoid laugh out loud xDDD
But viewmodel keyword in Koin acts as a factory? And if we want to share the VM in two fragments por example, can we use viewmodel injection like a singleton?
Cannot use koinComponents with KoinApplication composable fn any help?
.
Is koin module completely Kotlin based, can we use it with KMM? As we know we can not use dagger-hilt there 🙅♂️
Koin is available for KMM.
You still use koin on your project?
Hello sir can you make a tutorial about mobile banking apps. like Bkash is very advance apps in Bangladesh.
how to inject constructor?
Hello sir, I am confuse right now my plan is to learn Android development but when I see there are too many videos on the youtube and Fb groups peopls are doing with Flutter right now , ma aim is to get a job in android development can you please guid me what i do , should I need to start with the Kotlin programming or start as a Flutter , I want to do a Job in Android Development. plz answer my question.
Both are great ways to develop apps, but if you want to become an android developer, you should learn the android sdk
Start as a Fluffer
Before Dagger Hilt I used to work with koin. It was my first DI library. Then I tried Dagger Hilt and I liked it more))) Hilt was more easier for me to get used to it. Maybe I prefer annotation processing over DSL))
Soo easy to use koin, hello from russia)
When you are creating a Library, we can't use HILT for dependency injection as we can't force the consumer to integrate HILT in their project. I believe then KOIN is life saviour.
perfecto
Btw big 🐕 isn't it pronounced the same as "coin" is, like the little metal pieces of currency?
when you talk about the creation of module, on the `single` part, not talking about the life of a programmer😂😂😂😂😂😂
The main difference is that Koin is a PURE Kotlin library and Hilt NOT, therefore Koin can be used in KMM/D-KMP projects where Hilt cannot!
'....don't wanna talk about the life of a programmer' 😂😂😂
Koin isn't dependency injection actually. It's a service locator. The end result is pretty much the same, both provide dependency, however they do it differently and hilt does it much faster, because it's done at compile time. In other words Koin has no build time impact, but has a runtime one. The opposite is true for hilt.
And that's what I said in the video :)
@@PhilippLackner yeah, I kinda commented before watching the whole thing.
What if my adapter looks like this RouteAdapter(val clickCallback: (Route) -> Unit
Then we are creating what inside module? :D
and what if my repository looks like this
class Repository(
private val routeApi: RouteApi,
private val RouteCacheDataSource: RouteCacheDataSource
) and my koin need this 2 dependency? ^^ just we have to use Repository(get(), get()) ?: P
12:23 Come on man... :(
Can you teach how to make website using kotlin or please link any tutorial below
Wait, you're telling me it isn't said "Coin"?!?
I'm pretty sure it is, it wouldn't make a heck of a lotta sense if that wasn't the case.
Single = The life of a programmer😂
The domain name is literally "insert-koin". It's obviously intended to be pronounced "coin"!
single not about life of programmer😂
I like koin more
"Single, but I'm not talking about the life of a programmer"
🤭
...
🤔
🥺🔫
Looks like KOIN might be a little easier to setup than Dagger/Hilt. Not that that's difficult but there is a series of things you need to setup to use it. May check out KOIN for my next project thanks for showing it big 🐕
Brorher
Wrong title
?
My bad
Philipp - I am trying to use mockito to mock an object that is passed as an argument to the constructor of myViewModel(val dice:Dice).
within the Dice class I just have a single method called roll() that just returns a random number between 1..6. It is not
It is not returning 3?
This is how my instrumentation setup:
@Before
fun init(){
stopKoin()
diceMock = mock(Dice::class.java)
`when`(diceMock.roll()).thenReturn(3)
val testModule = module {
single { diceMock }
viewModel{
DiceViewModel(diceMock)
}
}
startKoin{
// loadKoinModules(testModule)
modules(testModule)
}
}
@Test
fun roll_displaysNumber() {
`when`(diceMock.roll()).thenReturn(3)
onView(withId(R.id.button)).perform(click())
onView(withId(R.id.textView)).check(matches(isDisplayed()))
}