Kotlin Multiplatform 101, BPR

By pjain      Published Dec. 15, 2019, 7:29 a.m. in blog Programming   

KotlinConf 2017 - Deep Dive into Kotlin/Native by Andrey Breslav - YouTube

  • see 28' in https://www.youtube.com/watch?v=pjnHDXkeK-4

    Common module - pure Kt - high level classes/interfaces Platform module - actual fn implementation

  • kConf app also runs on ios kN llvm interoperates with .c objc swift code ...

  • Game force app

  • Future - cross to Windows ..

k Multiplatform


Developing Multiplatform Projects in Kotlin 1.2 - YouTube

Multiplatform strategies for Us

The basic idea with multi-platform projects is organizing your modules into a set of common and platform-specific modules.

- UI view / FE stuff .. 
    - Platform Native Libs allowing more "COMMON" code

Multiplatform in k1.2+ -- like JNI?

http://kotlinlang.org/docs/reference/multiplatform.html https://github.com/Xantier/multiplat-workshop

An important development aiming to make Kotlin more capable of expressing behaviour in common modules is a set of cross-platform libraries, including This should reduce the necessity of resorting to platform modules.

Platform-specific modules contain code that either runs on the JVM or on JavaScript and can freely access platform-specific libraries. For each platform-specific module, a common module shall exist that provides so called “expected declarations”, i.e., declarations that must be implemented in the platform-specific module. Thanks to this mechanism, you can call platform-specific code from platform-independent code.

While common modules can only contain Kotlin code and use Kotlin libraries, platform modules can also contain code in either Java or JavaScript and are compiled into target-specific format. As an example of this here, is how you can define a common module and its corresponding platform module:

    // Common module
    package org.jetbrains.foo
    expect class Foo(bar: String) {
        fun frob()
    fun main(args: Array<String>) {

    // JVM module
    package org.jetbrains.foo
    actual class Foo actual constructor(val bar: String) {
        actual fun frob() {
            println("Frobbing the $bar")

a Serialization library, https://github.com/kotlin/kotlinx.serialization

a Testing library, http://kotlinlang.org/api/latest/kotlin.test/index.html

SwMgt, Declarative Tools, Scaffolding, Codegen



There are no comments yet

Add new comment

Similar posts

SOA Api Metadata

Serverless Computing

Android Layouts Design 101

Drawing, Canvas in Kotlin