Kotlin Multiplatform - requirements ● Multiplatform code must be 100% pure Kotlin ● Platform specific code must be referenced using `expect` and `actual`
Kotlin Multiplatform - tutorial ● https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html ● Explains how to use `expect` and `actual` mechanism expect fun platformName(): String fun createApplicationScreenMessage() : String { return "Kotlin Rocks on ${platformName()}" }
Kotlin Multiplatform - tutorial v2.0 ● I want a realistic sample project, that reflects real world usage ● It should perform network operations ● UI should be managed by each platform, so only logic should be shared
Lets build! ● I wrote some details in this blog, please check it! ● https://tech.mercari.com/entry/2018/12/18/114010 ● I want to build this architecture
Lets build! ● First, lets build http client ● Because I’m normally an Android Engineer, lets use Retrofit ● https://square.github.io/retrofit/ ● It lets us make network calls just by creating an interface
Kotlin Multiplatform - requirements ● Multiplatform code must be 100% pure Kotlin ● Platform specific code must be referenced using `expect` and `actual`
Summary ● I made a Kotlin Multiplatform project! ● It has an Android and iOS app both backed by a common library ● Http client is not as easy to use as Retrofit ● return KotlinUnit() is ダサイ... ● Kotlin works anywhere and that makes it 可愛い ● https://github.com/panpanini/SplatMaps-Multiplatform