https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

Rohit Singh

06/13/2020, 7:44 AM
hi guys I am new to kmp I am trying to work on a sample project, I was planning to use coroutines. I need to understand how can I implement
<http://dispatchers.io|dispatchers.io>
in iosMain. 🙏
r

Rohit Singh

06/13/2020, 3:58 PM
@Chetan Sachdeva so I see this one is for UI, this cannot be used for
io
?
c

Chetan Sachdeva

06/13/2020, 4:00 PM
You can use the same for IO. Consider reading the official post or this blog. We are setting both Dispatchers with the iOS main queue, that’s because background threading is not ready yet, at least in a simple way. It’s not a problem since the HTTP call will be handled in background by Ktor. But in iOS, all the subsequent processing will take place on the Main thread meanwhile, in Android we can switch between Background and Main Dispatchers.
However, there are ways to do background work in native. You can check DroidconKotlin.
r

Rohit Singh

06/14/2020, 8:08 AM
thanks
2 Views