Hello everyone, can anyone explain why do we need ...
# multiplatform
n
Hello everyone, can anyone explain why do we need to add library separately in androidMain and iosMain and then commonMain, can't we add at once in commonMain and use it for ios and android both
j
I think since kotlin 1.4 you only have to add libraries to common main if it is a multiplatform library.
n
i was going though https://github.com/kotlin-hands-on/kmm-networking-and-data-storage kotlin hands for kmm they added ktor and sqldelight library in all platform like in commonMain, androidMain and in iosMain also
can we add only once in commonMain then use it for platform specific also
j
Nope that is not what is happening
Ktor core and sqldelight runtime are the libraries and they are only added to the common sourceset
Ktor-android is an extra package with helper functions for android
So that only has value on android.
n
okay then same way for ios also right
j
I think it counts for the other platform specific implementations as well
n
thanks @Joost Klitsie
j
You are welcome, it is not as straightforward as they make it sound :)