SlideShare a Scribd company logo
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Why share code?
• DRY
• same code/logic for different platforms
• productivity, features, less bugs, more platforms
Why share code?
• crossplatform in the past
• networking library in C
• Windows Mobile
• Windows
• Android
• Linux
Why share code?
• sharing entire components
• JVM servers can share business logic with Android apps
• All client apps share similar logic and features
Kotlin Multiplatfom In Action
Why share code?
• Mobile platforms share a
lot in common
Why NOT share code?
• Performance
• Slower innovation
• shared UI
• All or nothing
• Vendor lock-in
• Future
• Bugs/lack of features
Why use Kotlin Multiplatform?
• modern, industrial language
• similar to swift, easy for java devs to learn
• great tooling, ecosystem and community
• open-source
• write once, run native everywhere
Why use Kotlin Multiplatform?
• doesn’t limit you to subset of all platforms
• native access to entire platform API from Kotlin
• each platform get native, optimized binary
• fix bug once, for all platforms
• interoperability
• optional sharing
Why use Kotlin Multiplatform?
optional sharing
Why not other solutions?
• Flutter, React Native, Xamarin
• not same usecase
• sharing UI - risky
• new language, new tools, new libs
• accessing platform APIs is hard, bridges
• frameworks
Kotlin Multiplatfom In Action
Why not other solutions?
“Anything that requires you to make large decisions and
potentially large rewrites, perform large retrainings and rehirings,
or anything that has to share UI or doesn’t work well with a
native platform is, well, very risky.” - Kevin Galligan, Touchlab
Kotlin Multiplatfom In Action
JetBrains
• Coroutines
• Ktor
• kotlinx.serialization
• SQLDelight
• okio
• okhttp?
Touchlab
• Stately
Kotlin Multiplatfom In Action
How to start?
• Android Studio
• InteliJ IDEA
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Expect/actual
declare expected class/fun/property in common code
actually implement in platform-specific code
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin Multiplatfom In Action
Kotlin/Native
• iOS, Linux, Windows, MacOS, WebAssembly...
• build full apps or libs
• access to native platform APIs
• interoperable with C/ObjC(/Swift)
• Kotlin can call C/ObjC/Swift and vice-versa
• Kotlin can extend ObjC/Swift classes and vice-versa
Concurrency is hard
• languages/runtimes allow unsafe concurrency
• tools - locks & volatile
• no warnings
• deadlocks
• entire burden on devs
• no guaranties of safety
• bugs leak into production
Saner concurrency
• new, stricter memory model
• ARC with cycle collector
• 2 simple rules
• Immutable state can be shared among threads
• Mutable data belongs to one thread
• compiler and runtime check the rules
• thread-safe code
Saner concurrency
+GC per thread, no suspends
+shared reference counter with swift
-no global mutable state
-new concepts, patterns, practices
-coroutines
Saner concurrency
• Any.freeze()
• passing mutable data by detaching
• No manual concurrency management
• Workers
• Atomics - AtomicRef/Int/Long/...
• “Stranger threads” (link in resources)
Saner concurrency
• work in progress
• multithreaded coroutines
• similar rules for JVM
• relaxed memory model
Kotlin Multiplatfom In Action
Status
• beta but relatively stable
• low-risk
• production
• large projects - wait for release
• smaller projects - maybe
• part of a project - yesterday
Kotlin Multiplatfom In Action
resources: cutt.ly/kmp-ns
email: mmitic89@outlook.com
android-serbia slack: @Marko Mitić
kotlinlang slack: @Marko Mitic

More Related Content

PPTX
Kotlin Multiplatfom In Action
PPTX
Why Kotlin?
PDF
Isomorphic Kotlin
PPTX
Build software like a bag of marbles, not a castle of LEGO®
PDF
How to build a tool for operating Flink on Kubernetes
PPTX
.NET - The Current Spectrum
PPTX
An Introduction to Docker
PPTX
Coding in kotlin
Kotlin Multiplatfom In Action
Why Kotlin?
Isomorphic Kotlin
Build software like a bag of marbles, not a castle of LEGO®
How to build a tool for operating Flink on Kubernetes
.NET - The Current Spectrum
An Introduction to Docker
Coding in kotlin

What's hot (20)

PPTX
Testing Without a GUI Using TestComplete
PPTX
Java Presentation
PDF
Building a Language Server for Eclipse MicroProfile
PDF
Robot Framework with actual robot
PDF
Docker: Fire your Sysadmin and use Docker to build, ship and run any app, any...
PDF
Landscape of Eclipse MicroProfile Tools
PDF
The tools & technologies behind Resin.io
PPTX
Chapter 1 java
PPT
Docker Practical Use Cases
PDF
The Beam Vision for Portability: "Write once run anywhere"
PDF
Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...
PDF
PHPKonf Istanbul 2016 - From development to production with Docker Datacenter
PDF
10 Reasons Why Java Now Rocks More Than Ever
PPTX
Intro to Codefresh YAML
PDF
Jenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
PPT
Docker ata glance
PDF
Swift should I switch?
PPTX
A basic overview of Containers
PDF
Docker Introduction
PDF
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Testing Without a GUI Using TestComplete
Java Presentation
Building a Language Server for Eclipse MicroProfile
Robot Framework with actual robot
Docker: Fire your Sysadmin and use Docker to build, ship and run any app, any...
Landscape of Eclipse MicroProfile Tools
The tools & technologies behind Resin.io
Chapter 1 java
Docker Practical Use Cases
The Beam Vision for Portability: "Write once run anywhere"
Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Ma...
PHPKonf Istanbul 2016 - From development to production with Docker Datacenter
10 Reasons Why Java Now Rocks More Than Ever
Intro to Codefresh YAML
Jenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
Docker ata glance
Swift should I switch?
A basic overview of Containers
Docker Introduction
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Ad

Similar to Kotlin Multiplatfom In Action (20)

PPT
Native App Development for iOS, Android, and Windows with Visual Studio
PPTX
Cross Platform Development in C# (DDDNorth 2013)
PPT
Portable Class Library Deep Dive
PPTX
Future of Kotlin - How agile can language development be?
PDF
Building a Cross-Platform Mobile SDK in Rust.pdf
KEY
The Architect Way
PPTX
C# everywhere: Xamarin and cross platform development
PDF
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
PPTX
Go: What's Different ?
PDF
NetWork - 15.10.2011 - Applied code generation in .NET
PDF
Starting from scratch in 2017
PPTX
Coding in kotlin
PDF
Italian Alt.Net Conference MonoTouch Session
PPTX
Introduction to xamarin
PDF
ITB2024 - Keynote Day 1 - Ortus Solutions.pdf
PDF
GWT Jug Stuttgart
PPTX
Radu vunvulea building and testing windows 8 metro style applications using ...
PPTX
ECE-3567-Lecture-1-Spring-2025 for beginner
PDF
Titanium: Native Mobile Apps with Javascript
Native App Development for iOS, Android, and Windows with Visual Studio
Cross Platform Development in C# (DDDNorth 2013)
Portable Class Library Deep Dive
Future of Kotlin - How agile can language development be?
Building a Cross-Platform Mobile SDK in Rust.pdf
The Architect Way
C# everywhere: Xamarin and cross platform development
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
Go: What's Different ?
NetWork - 15.10.2011 - Applied code generation in .NET
Starting from scratch in 2017
Coding in kotlin
Italian Alt.Net Conference MonoTouch Session
Introduction to xamarin
ITB2024 - Keynote Day 1 - Ortus Solutions.pdf
GWT Jug Stuttgart
Radu vunvulea building and testing windows 8 metro style applications using ...
ECE-3567-Lecture-1-Spring-2025 for beginner
Titanium: Native Mobile Apps with Javascript
Ad

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Approach and Philosophy of On baking technology
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
August Patch Tuesday
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Machine learning based COVID-19 study performance prediction
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Machine Learning_overview_presentation.pptx
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
A Presentation on Artificial Intelligence
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Tartificialntelligence_presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Approach and Philosophy of On baking technology
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
NewMind AI Weekly Chronicles - August'25-Week II
Assigned Numbers - 2025 - Bluetooth® Document
August Patch Tuesday
A comparative study of natural language inference in Swahili using monolingua...
Mobile App Security Testing_ A Comprehensive Guide.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Machine learning based COVID-19 study performance prediction
Diabetes mellitus diagnosis method based random forest with bat algorithm
Building Integrated photovoltaic BIPV_UPV.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Machine Learning_overview_presentation.pptx
Heart disease approach using modified random forest and particle swarm optimi...
A Presentation on Artificial Intelligence
TLE Review Electricity (Electricity).pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Kotlin Multiplatfom In Action

  • 7. Why share code? • DRY • same code/logic for different platforms • productivity, features, less bugs, more platforms
  • 8. Why share code? • crossplatform in the past • networking library in C • Windows Mobile • Windows • Android • Linux
  • 9. Why share code? • sharing entire components • JVM servers can share business logic with Android apps • All client apps share similar logic and features
  • 11. Why share code? • Mobile platforms share a lot in common
  • 12. Why NOT share code? • Performance • Slower innovation • shared UI • All or nothing • Vendor lock-in • Future • Bugs/lack of features
  • 13. Why use Kotlin Multiplatform? • modern, industrial language • similar to swift, easy for java devs to learn • great tooling, ecosystem and community • open-source • write once, run native everywhere
  • 14. Why use Kotlin Multiplatform? • doesn’t limit you to subset of all platforms • native access to entire platform API from Kotlin • each platform get native, optimized binary • fix bug once, for all platforms • interoperability • optional sharing
  • 15. Why use Kotlin Multiplatform? optional sharing
  • 16. Why not other solutions? • Flutter, React Native, Xamarin • not same usecase • sharing UI - risky • new language, new tools, new libs • accessing platform APIs is hard, bridges • frameworks
  • 18. Why not other solutions? “Anything that requires you to make large decisions and potentially large rewrites, perform large retrainings and rehirings, or anything that has to share UI or doesn’t work well with a native platform is, well, very risky.” - Kevin Galligan, Touchlab
  • 20. JetBrains • Coroutines • Ktor • kotlinx.serialization
  • 21. • SQLDelight • okio • okhttp? Touchlab • Stately
  • 23. How to start? • Android Studio • InteliJ IDEA
  • 31. Expect/actual declare expected class/fun/property in common code actually implement in platform-specific code
  • 35. Kotlin/Native • iOS, Linux, Windows, MacOS, WebAssembly... • build full apps or libs • access to native platform APIs • interoperable with C/ObjC(/Swift) • Kotlin can call C/ObjC/Swift and vice-versa • Kotlin can extend ObjC/Swift classes and vice-versa
  • 36. Concurrency is hard • languages/runtimes allow unsafe concurrency • tools - locks & volatile • no warnings • deadlocks • entire burden on devs • no guaranties of safety • bugs leak into production
  • 37. Saner concurrency • new, stricter memory model • ARC with cycle collector • 2 simple rules • Immutable state can be shared among threads • Mutable data belongs to one thread • compiler and runtime check the rules • thread-safe code
  • 38. Saner concurrency +GC per thread, no suspends +shared reference counter with swift -no global mutable state -new concepts, patterns, practices -coroutines
  • 39. Saner concurrency • Any.freeze() • passing mutable data by detaching • No manual concurrency management • Workers • Atomics - AtomicRef/Int/Long/... • “Stranger threads” (link in resources)
  • 40. Saner concurrency • work in progress • multithreaded coroutines • similar rules for JVM • relaxed memory model
  • 42. Status • beta but relatively stable • low-risk • production • large projects - wait for release • smaller projects - maybe • part of a project - yesterday
  • 44. resources: cutt.ly/kmp-ns email: mmitic89@outlook.com android-serbia slack: @Marko Mitić kotlinlang slack: @Marko Mitic