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

Daniele B

12/07/2020, 2:12 PM
Just created this new slide, summarizing what are the new components to use with KMP:
👍 13
b

BollywoodVillain

12/07/2020, 3:33 PM
Thanks for creating this, I was looking into how to use SwiftUI/Combine and your previous posts are really helpful.
h

HankG

12/07/2020, 6:51 PM
A lot of "the future" feels more present day which is cool...I need at the concurrency line more carefully. I thought exposing coroutines to Android/iOS was a bad idea
d

Daniele B

12/07/2020, 6:55 PM
@HankG you just need to use coroutines in the KMP shared code. You don’t need to expose them to the Android/iOS specific part.
👍 1
b

BollywoodVillain

12/07/2020, 6:55 PM
I’m not well versed with the coroutines implementation on iOS, but what are the main critiques against exposing coroutines to the platforms? Also I thought Kotlin coroutines will be part of Android ecosystem (like ktor) sooner or later.
d

Daniele B

12/07/2020, 8:21 PM
@BollywoodVillain Ktor Client is a Kotlin MultiPlatform HTTP client library, not related to a specific platform. On Android it uses HTTPUrlConnection under the hood, and on iOS, it uses NSURLSession. Coroutines are also a multi-platform feature of Kotlin. It makes sense to use them in the shared code. I guess you could also expose it to an iOS app, and collect it via Swift callbacks, but that in most cases could be avoided.
b

BollywoodVillain

12/08/2020, 6:55 AM
What’s under the hood of the coroutines when they run on iOS? I wonder how the
async/await
has been implemented, is it GCD?
d

Daniele B

12/08/2020, 2:18 PM
@BollywoodVillain I actually don't know for sure, but I suspect they use GCD.
4 Views