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
JetBrainsのAI機能の紹介 #jjug
yusuke
0
110
AI Agent 時代のソフトウェア開発を支える AWS Cloud Development Kit (CDK)
konokenj
6
1k
ご注文の差分はこちらですか? 〜 AWS CDK のいろいろな差分検出と安全なデプロイ
konokenj
4
710
AIともっと楽するE2Eテスト
myohei
9
3.2k
MCPを使ってイベントソーシングのAIコーディングを効率化する / Streamlining Event Sourcing AI Coding with MCP
tomohisa
0
190
Gemini CLI のはじめ方
ttnyt8701
1
110
AIに安心して任せるためにTypeScriptで一意な型を作ろう
arfes0e2b3c
0
270
なぜあなたのオブザーバビリティ導入は頓挫するのか
ryota_hnk
3
510
状態遷移図を書こう / Sequence Chart vs State Diagram
orgachem
PRO
3
290
Comparing decimals in Swift Testing
417_72ki
0
100
中級グラフィックス入門~効率的なメッシュレット描画~
projectasura
3
1.7k
マッチングアプリにおけるフリックUIで苦労したこと
yuheiito
0
240
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
How to train your dragon (web standard)
notwaldorf
96
6.1k
How to Ace a Technical Interview
jacobian
278
23k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
The Pragmatic Product Professional
lauravandoore
35
6.8k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Designing Experiences People Love
moore
142
24k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
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