The New Cross-Platform Kid in Town
Wajahat Karim
wajahatkarim.com
WajahatKarim
2006
2018
Cross-platform
(advantages)
- Faster learning curve
- Smaller team size
- Half of the cost compared to fully native
- Less number of working hours to build
Cross-platform
(disadvantages)
- Tightly dependent on the native framework implementation
- Performance is often affected due to bridging / conversion
- Some native code needs to be written
- New updates from OS will take time to written in cross-platform
Cross-platform
(how it works)
https://wajahatkarim.com/2019/11/how-is-flutter-different-from-native-web-view-and-other-cross-platform-frameworks/
The conversion happens here
kotlin
multiplatform
shares application logic
does not share application UI or native stuff
Cross-platform
(disadvantages)
- Tightly dependent on the native framework implementation
- Performance is often affected due to bridging / conversion
- Some native code needs to be written
- New updates from OS will take time to written in cross-platform
Cross-multiplatform
(disadvantages)
- Tightly dependent on the native framework implementation
- Performance is often affected due to bridging / conversion
- Some native code needs to be written
- New updates from OS will take time to written in cross-platform
Every platform specific thing like for Android / iOS etc is developed natively.
Since its native implementation, so no impact on performance.
Every platform specific thing like for Android / iOS etc is developed natively.
Yes, the UI and other platform-specific code like runtime permissions, hardware APIs etc.
Kotlin Multiplatform
(advantages)
- Kotlin is one of the most trending languages with strong community support
- Low risk as you decide what's worth to share across platforms
- Consistency across platforms
- Supports Android, iOS, Web, Desktop (Mac, Linux, Windows) and more coming.
Android
iOS
Web/Desktop
Android
iOS
Web/Desktop
UI
UI
UI
xml / kotlin
objective-c / swift
html / javascript
Android
iOS
Web/Desktop
UI
UI
UI
presenter / VM
presenter / VM
presenter / VM
model
model
model
parser
parser
parser
network / db
network / db
network / db
business logic
business logic
business logic
xml / kotlin
objective-c / swift
html / javascript
Android
iOS
Web/Desktop
UI
UI
UI
presenter / VM
model
parser
network / db
business logic
common / shared
xml / kotlin
swift / swift UI
javascript / kotlin JS
but how can different platforms can communicate?
https://medium.com/@xxfast/going-fully-multiplatform-1-migrating-your-android-project-to-kotlin-multiplatform-8fc38763307
expect
actual
declared class or method at common/shared module
declared at Android module for Android implementation
declared at iOS module for iOS implementation
declared at js module for Web/Javascript implementation
declared at ...
commonMain
commonMain
Targets: Android, iOS, and Web
- define actual on Android
- define actual on iOS
- define actual on Web
Platform-specific code
Platform-specific code
https://www.cafonsomota.xyz/talks/2020-12-14-droidcon-apac-a-multiplatform-adventure/2020-12-14-droidcon-apac-a-multiplatform-adventure/
Kotlin Multiplatform
(conclusion)
- Strong community
- Many big companies are using Kotlin
- Jetbrains and Google are pushing Kotlin in
- Fantastic support at Slack https://kotlinlang.slack.com
- Zero repetition to develop your features business logic
- One tech stack for all your targets.
Resources
(articles, links and sample projects)
https://github.com/JetBrains/compose-jb
https://github.com/touchlab/KaMPKit
https://github.com/joreilly
https://kotlinlang.org/lp/mobile/
https://kotlinlang.slack.com
https://github.com/terrakok/kmm-awesome
Jetpack Desktop Samples
Kotlin Multiplatform Kit
A fantastic GDE working on Kotlin Multiplatform
Official documentation on Kotlin Multiplatform
Slack channel for Kotlin Multiplatform
List of different examples and libraries on Kotlin Multiplatform
Carlos Mota
Codelabs
Special thanks for helping me create these slides
https://cmota.github.io/kmp-codelabs
cafonsomota
WajahatKarim
wajahatkarim.com/subscribe
wajahatkarim.com