AlikElzin-kilaka
AlikElzin-kilaka

Reputation: 36021

What are the platform common classes in Kotlin?

I'd like to use Kotlin to define interfaces between client and server.

Currently, Kotlin can be used in 3 platforms: Java, Android, Web(JS).

What Kotlin build-in classes can I use across all these platform?

I would expect some common library dependency between kotlin-stdlib and kotlin-stdlib-js, but couldn't find one.

On the other hand, I managed to create the following interface that can be used on all 3 platforms:

interface SomeApi {
    fun update(params: Collection<String>)
}

So, how can I figure out what can be used across all platforms, in addition to Collection?

Upvotes: 4

Views: 222

Answers (1)

Kirill Rakhman
Kirill Rakhman

Reputation: 43851

You should be able to use all classes in kotlin-runtime and kotlin-stdlib, especially everything that's in the stdlib/common folder in the Github repo.

Multiplatform projects are currently in development and once they're released, it should be easier to write platform independent code.

Upvotes: 5

Related Questions