Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Intro to Kotlin/Native and Multi-platform Projects
Search
Dmitriy Gorbunov
May 29, 2019
Programming
1
24
Intro to Kotlin/Native and Multi-platform Projects
Dmitriy Gorbunov
May 29, 2019
Tweet
Share
More Decks by Dmitriy Gorbunov
See All by Dmitriy Gorbunov
RxPM-library
dmdevgo
0
65
RxPM vs MVP vs MVVM
dmdevgo
0
220
Other Decks in Programming
See All in Programming
PipeCDのプラグイン化で目指すところ
warashi
1
270
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
2
150
AI駆動のマルチエージェントによる業務フロー自動化の設計と実践
h_okkah
0
110
プロダクト志向なエンジニアがもう一歩先の価値を目指すために意識したこと
nealle
0
130
Node-RED を(HTTP で)つなげる MCP サーバーを作ってみた
highu
0
120
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
240
猫と暮らす Google Nest Cam生活🐈 / WebRTC with Google Nest Cam
yutailang0119
0
110
Goで作る、開発・CI環境
sin392
0
230
#kanrk08 / 公開版 PicoRubyとマイコンでの自作トレーニング計測装置を用いたワークアウトの理想と現実
bash0c7
1
740
MDN Web Docs に日本語翻訳でコントリビュートしたくなる
ohmori_yusuke
1
120
A full stack side project webapp all in Kotlin (KotlinConf 2025)
dankim
0
110
レベル1の開発生産性向上に取り組む − 日々の作業の効率化・自動化を通じた改善活動
kesoji
0
150
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
328
39k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.4k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Testing 201, or: Great Expectations
jmmastey
43
7.6k
How GitHub (no longer) Works
holman
314
140k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
Designing for Performance
lara
610
69k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Thoughts on Productivity
jonyablonski
69
4.7k
It's Worth the Effort
3n
185
28k
How STYLIGHT went responsive
nonsquared
100
5.6k
A Tale of Four Properties
chriscoyier
160
23k
Transcript
Введение в Kotlin/Native и мультиплатформенные проекты Дмитрий Горбунов Lead Android
Developer
Native vs Cross-platform
Multi-platform Server Kotlin/JVM iOS Kotlin/Native Android Kotlin/JVM Browser Kotlin/JS Common
code
Hello, Kotlin/Native fun main(args: Array<String>) { println("Hello, Kotlin/Native!") }
Kotlin/Native Kotlin Compiler LLVM .kt Intermediate Representation (IR) 10101 01010
10101
Kotlin/Native • Маленький размер рантайма (Hello World ~ 850 KB)
• Встроенный GC • C Interop • Objective-C and Swift Interop
Kotlin/Native Target Platforms ❏ Windows (x86_64) ❏ Linux (x86_64, arm32,
MIPS, MIPS little endian) ❏ MacOS (x86_64) ❏ iOS (arm32, arm64, x64) ❏ Android (arm32, arm64) ❏ STM32 ❏ WebAssembly (wasm32)
Kotlin/Native Binaries ➔ Executable file (*.kexe) ➔ Kotlin/Native library (*.klib)
➔ Apple framework (Obj-C framework) ➔ Dynamic library (*.so, *.dylib, *.dll) ➔ Static library
Platform-Specific Declarations // Common expect fun platformName(): String // Android
actual fun platformName(): String { return "Android ${Build.VERSION.RELEASE}" } // iOS actual fun platformName(): String { return UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion }
Platform-Specific Declarations // Common expect fun platformName(): String // Android
actual fun platformName(): String { return "Android ${Build.VERSION.RELEASE}" } // iOS actual fun platformName(): String { return UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion }
Multiplatform Module Common main expect class Bar fun foo(b: Bar)
{} Android main actual class Bar {} iOS main actual class Bar {}
Multiplatform Project Android-приложение (Android Studio) iOS-приложение (Xcode) Мультиплатформенный модуль
Multiplatform Module
Multiplatform Module expect fun platformName(): String
Multiplatform Module import platform.UIKit.UIDevice actual fun platformName(): String { return
UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion }
Multiplatform Module import android.os.Build actual fun platformName(): String { return
"Android ${Build.VERSION.RELEASE}" }
Shared Code Android View Presenter Repository DTO iOS View Interactor
Entity API DB SDK
Shared Code Android View Presenter Repository DTO iOS View Interactor
Entity API DB SDK
Shared Code Android View Presenter Repository DTO iOS View Interactor
Entity API DB SDK
Shared Code Android View Presenter Repository DTO iOS View Interactor
Entity API DB SDK KTOR SQLDelight kotlinx serialization ?
Shared Code Android View ViewModel ? Repository DTO iOS View
Interactor Entity API DB SDK KTOR SQLDelight kotlinx serialization ?
Issues • Multi-threaded coroutines https://github.com/Kotlin/kotlinx.coroutines/issues/462 • UI dispatcher for iOS
https://github.com/Kotlin/kotlinx.coroutines/issues/470 • Kotlin Generics to Swift Generics https://github.com/JetBrains/kotlin-native/issues/2429 • Kotlinx.serialization https://github.com/Kotlin/kotlinx.serialization/issues/395
Links • Официальный туториал https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html • Семпл приложения под Android
и iOS https://github.com/MobileUpLLC/Multiplatform-Sample • KotlinConf App - пример рабочего приложения от Jetbrains https://github.com/JetBrains/kotlinconf-app
Спасибо! Дмитрий Горбунов email:
[email protected]
telegram: @dmdev Habr: https://habr.com/ru/users/dmdev/posts/ RxPM:
https://github.com/dmdevgo/RxPM