Lunch and Learn Kotlin Multi-platform on
Topics • Presentation on Kotlin multi-platform • Code overview • Build framework and run a PoC app • Q&A
Vikram Hooda Mobile application developer
Kotlin Multi-platform • Designed by JetBrains. • Shares non-ui logic on different platforms and uses Kotlin language. • Open source, natively-integrated and optional sharing. • Code sharing, not cross-platform. • Current Status: Experimental state
Target Platforms Overview
Common JSJVM Native Java Android Browser Node iOS Linux Window Embedded .jar .framework.js
Configure KMPP project
Create a new Android and iOS project, if you do not have one.
Create a new module(“Shared”) under Android project to serve common functionality to target platforms. Shared module
Now, create target specific directory under “Shared” module. Shared module directory structure
Set dependencies and target in Shared module’s “build.gradle” file.
Target configuration Target configuration
Plugin configuration Plugin configuration
Dependencies configuration Dependencies configuration
Shared Logic Mechanism
Common Module (Shared business logic) Native Platforms Module (Android, iOS) expect actual “expect/actual” Keywords
• “expect” declares in common module. • expect val plateformName: String //In common code • “actual” defines in target module. • actual val plateformName: String = “Android” //In Android code • actual val plateformName: String = “iOS” //In iOS code
 Example of “expect/actual” keyword
Pro & Cons
Pros • Code sharing • Single source of truth for business logic to native platform • Less refactoring/rewriting efforts • Time and cost saving
Cons • Lack of libraries support . • Concurrency complications on iOS. • Painful debugging and runtime exception tracing on yet supported on iOS . • Must to have all targeted platform’s basic knowledge i.e. Kotlin, Swift, Android and iOS apis.
Code iOS: 
 https://github.com/vkhooda24/KnowMyCountry-iOS-Multi-platform Android and Multi-platform: 
 https://github.com/vkhooda24/KnowMyCountry-Kotlin-Multiplatform
Thank you!

Kotlin multi platform