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

Thomas Skovsgaard

05/20/2020, 6:13 AM
Hi, I'm at the very beginning creating a shared library for our iOS and Android app, first just to take care of all the shared network requests, but then I read this article: https://proandroiddev.com/clean-architecture-example-with-kotlin-multiplatform-c361bb283fd0 where it states "_We don’t show any loading indicator, because there’s on big issue: Kotlin/Native does not support multithreading at the moment._" Is this still the truth, the article is a bit old (june 2019) ?
One more question, do you have a link for some best practice using ktor?
j

John O'Reilly

05/20/2020, 7:33 AM
For the last number of kotlinx coroutine releases there's been a
-native-mt
version which you can generally use to allow multithreading when using kotlin/native. I think it will be included as standard in 1.4 release (but also note that current version of ktor doesn't work with that, at least without certain workarounds, on particular platforms)
t

Thomas Skovsgaard

05/20/2020, 7:39 AM
Ok thanks, so if you were going to setup a shared library today, what would be the way to go ?
k

kpgalligan

05/20/2020, 6:36 PM
Just want to point out here, “therefore a loading indicator doesn’t make much sense when we’re doing network on the main thread.” This is wrong anyway. The actual network call does not happen on the main thread. This is a major misconception about coroutines and suspending operations. A loading indicator would absolutely make sense in this context. Also, yes, there’s MT coroutines that are usable, but ktor support is pending (but, again, the actual network request is not on the main thread)