Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Intro to Kotlin/Native and Multi-platform Projects
Search
Dmitriy Gorbunov
May 29, 2019
Programming
31
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Intro to Kotlin/Native and Multi-platform Projects
Dmitriy Gorbunov
May 29, 2019
More Decks by Dmitriy Gorbunov
See All by Dmitriy Gorbunov
RxPM-library
dmdevgo
0
75
RxPM vs MVP vs MVVM
dmdevgo
0
240
Other Decks in Programming
See All in Programming
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
590
ジョジョの世界をXRで再現する
mofurune
0
160
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
280
R8 の設定見直しでアプリサイズ削減
andpad
0
220
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
230
カツオ、ご期待ください
suneo3476
0
190
Workers Cache を知る
syumai
0
370
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
最近”作らせてる” ローカルAIアプリの話
akit37
0
470
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
Featured
See All Featured
Ruling the World: When Life Gets Gamed
codingconduct
0
400
Exploring anti-patterns in Rails
aemeredith
4
540
Claude Code のすすめ
schroneko
67
230k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
The Pragmatic Product Professional
lauravandoore
37
7.5k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
990
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
930
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
480
Everyday Curiosity
cassininazir
0
350
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
820
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