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

Kulwinder Singh

10/30/2019, 11:58 AM
How i can send constructor variables while using
viewModels
ktx extension function ?
h

HarryPulvirenti

10/30/2019, 12:02 PM
by viewModels
is an extensions provided by koin?
b

Blundell

10/30/2019, 12:03 PM
You have to use a factory to inject
h

Heitor Ribeiro

10/30/2019, 12:03 PM
@Kulwinder Singh I’m using
<https://github.com/InsertKoinIO/koin>
Untitled.kt
h

HarryPulvirenti

10/30/2019, 12:09 PM
Maybe you can create a separate class to hold the user instances and share this UserHolder by koin to access the actual data. You can try with this strategy but I don’t know if those can fit your needs.
k

Kulwinder Singh

10/30/2019, 12:30 PM
@HarryPulvirenti @Heitor Ribeiro no i'm not using
koin
,
by viewModel
is from
fragment-ktx
https://developer.android.com/kotlin/ktx#fragment
@Blundell any example/sample ? i remember i have done similar in past, but that was without
by viewModel
also i forgot how it was in past
or use #koin 🙂
👎 1
🤩 1
👍 3
p

pitpit

10/30/2019, 12:44 PM
search cdelab kotlin fundamentals android. use viewmodelfactory
👍 1
k

Kulwinder Singh

10/31/2019, 7:48 AM
@pitpit thanks, i found it inside codelab
2 Views