-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHow To
15 lines (13 loc) · 811 Bytes
/
How To
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Following step to setup coroutines
1)Add coroutines dependencies
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
Note : It will working on Kotlin version 1.3 or better
2)Add ViewModel dependencies for MVVM architecture
implementation 'org.koin:koin-android-viewmodel:2.0.1'
3)Add Retrofit dependencies for network calling
implementation("com.squareup.okhttp3:logging-interceptor:4.2.0")
implementation "com.squareup.retrofit2:retrofit:2.6.1"
implementation "com.squareup.retrofit2:adapter-rxjava2:2.6.1"
Implementations:
Use CoroutineScope(Dispatchers.Main).launch = This is used for Update UI on main thread (This is same as AndroidSchedulers.Main)
Use CoroutineScope(Dispatchers.IO).launch = Implements operation on IO thread (This is same as Schedulers.io)