Jacob Ras
02/28/2024, 11:47 AMcurioustechizen
02/28/2024, 12:49 PMcurioustechizen
02/28/2024, 12:50 PMJacob Ras
02/28/2024, 12:52 PMJoel Denke
02/28/2024, 1:11 PMAlso, if you're used to Hilt, you might be tempted to write @Inject constructor. That's not needed with Koin, the single annotation above the class is enough.
I love this πJoel Denke
02/28/2024, 1:14 PMJoel Denke
02/28/2024, 1:16 PMJacob Ras
02/28/2024, 1:32 PMI love this πThanks, haha! Wasn't meant as a snarky remark or anything, but I just noticed how I was a bit surprised I didn't have to write it when I started using K-A.
Btw does Koin work with android specific thingsAbsolutely. Of course, inside
[androidMain]
you can provide&inject anything you like, but if you use koin-android
with inside the startKoin{}
block the line androidContext(this@Application)
, then Context
becomes available to inject anywhere by default. I'll add that to the post!
Also from your experience, how does Koin Annotations impact compile time?I have done no benchmarks here, but KSP is a speedy plugin. In the biggest Koin-project I have I don't feel K-A impacts performance a lot. Compiling code still takes up most of the time and often the ksp tasks are up-to-date and skipped anyway because its a modularised project π
Joel Denke
02/28/2024, 1:35 PMJoel Denke
02/28/2024, 1:36 PMJacob Ras
02/28/2024, 1:45 PM@InjectedParam
and when you actually retrieve the thing you need, in you activity, you do get<SomeThing> { parametersOf(this@Activity) }
. But I'm wondering why you'd like to inject an activity, I find it's often best to avoid such constructions π
Right many DI still using Kapt or such?
kapt
is a similar thing to ksp
. Both are compiler plugins, but ksp is newer, faster ("up to two times faster") and works with Kotlin/Native.Joel Denke
02/28/2024, 1:48 PMJoel Denke
02/28/2024, 1:49 PMJoel Denke
02/28/2024, 1:49 PMJacob Ras
02/28/2024, 1:50 PMKtor
needs it in its setup, for example. And if you want to do anything with Bluetooth for example, you need the service which is obtained through Context. Nothing wrong with that πJoel Denke
02/28/2024, 1:57 PMJoel Denke
02/28/2024, 1:57 PMJoel Denke
02/28/2024, 1:57 PMPedro Francisco de Sousa Neto
02/28/2024, 2:27 PMAngga Ardinata
02/29/2024, 2:41 AMarnaud.giuliani
02/29/2024, 6:12 PMarnaud.giuliani
02/29/2024, 6:12 PMJacob Ras
02/29/2024, 7:47 PMVedran
03/07/2024, 12:44 AMarnaud.giuliani
03/08/2024, 8:38 AMVedran
03/09/2024, 3:14 PMarnaud.giuliani
03/11/2024, 4:09 PMJacob Ras
03/11/2024, 5:55 PMVedran
03/11/2024, 5:59 PMbuildTypes.release {
proguard {
version.set("7.4.2")
isEnabled.set(true)
optimize.set(false)
obfuscate.set(false)
configurationFiles.from(project.file("<http://compose-desktop.pro|compose-desktop.pro>"))
}
After adding above into build.gradle.kts it works.Jacob Ras
03/11/2024, 6:09 PM