Does anyone uses Coroutine with Retrofit here ??? ...
# android
k
Does anyone uses Coroutine with Retrofit here ??? Any link of a tutorial i can use ??? i want to implement it
k
Thank @gildor.. do u have a video link too?
g
Video link for what? Video tutorial?
k
yea video tutorial // i tried
youtube but not getting it well
g
It is a couple of a pretty simple libraries, just check Readme, don’t see any reason to have video tutorial for a lib with a couple classes
If you not familiar with coroutines in general, please take a look to documentation section of kotlinx.coroutines: https://github.com/Kotlin/kotlinx.coroutines#documentation
k
many thanks .. i have an app i build but is taking long to display data to the ui so i thought using coroutine can solve it .. many thanks man
g
Also you can find a couple videos from Roman Elizarov, author of coroutines from JetBrains:

https://www.youtube.com/watch?v=_hfBv0a09Jc

https://www.youtube.com/watch?v=YrrUCSi72E8

There is nothing special about usage Coroutines with Retrofit, especially when adapter libraries already available
k
Thanks.. i will give it a
short
... hope it will solve my problems
g
i have an app i build but is taking long to display data to the ui
Not sure what do you mean. Coroutines cannot make data downloading faster, coroutines about a different way to work with callbacks and async APIs
k
okay .. i do understand that why i wanted to use coroutine by thinking it will help to run data in the background and display them when it available ..
let me do some googling
cz i deployed my app yesterday then i saw that problem
g
Retrofit already run request in background if you use async API. Probably you misunderstood your problem, before rewriting, try to understand the source of you problem
p
@gildor I use your small lib in all my Retrofit projects. I really like how you make it easy to get a Response or a Result. I've used a similar approach to adapt other async APIs to coroutines, thank you!
g
@Pierre-Luc Paour Thanks, glad to hear 🙏 It’s not my invention of course, quite common patter in Functional Programming (ADT) But it works pretty well with Retrofit 👍