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
Kotlin 2.0을 통해 알아보는 코틀린의 미래
Search
Leonardo YongUk Kim
May 24, 2023
Programming
2.5k
1
Share
Kotlin 2.0을 통해 알아보는 코틀린의 미래
라인 테크 토크에서 공유한 "코틀린 2.0을 통해 알아보는 코틀린의 미래" 발표 자료입니다.
Leonardo YongUk Kim
May 24, 2023
More Decks by Leonardo YongUk Kim
See All by Leonardo YongUk Kim
Recap: Kotlin Language Features in 2.0 and Beyond (Michail Zarečenskij)
dalinaum
0
710
Compose Multiplatform 101
dalinaum
3
700
실리콘밸리 스타트업에서 일어난 일
dalinaum
0
170
AlphaGo에서 시작하는 인공지능
dalinaum
1
340
Zip: Data compression (20분만에 배우는 압축 알고리즘)
dalinaum
1
2.7k
안드로이드 빌드: 설탕없는 세계
dalinaum
0
170
Obfuscation 101 @ Naver Tech Concert
dalinaum
4
730
Realm은 어떻게 효율적인 데이터베이스를 만들었나?
dalinaum
1
710
MVC부터 MVVM, 단방향 데이터 흐름까지
dalinaum
5
940
Other Decks in Programming
See All in Programming
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
310
夢の無限スパゲッティ製造機 -実装篇- #phpstudy
o0h
PRO
0
190
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
2.3k
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
860
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
550
PDI: Como Alavancar Sua Carreira e Seu Negócio
marcelgsantos
0
100
Codex CLI でつくる、Issue から merge までの開発フロー
amata1219
0
330
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
130
Vibe하게 만드는 Flutter GenUI App With ADK , 박제창, BWAI Incheon 2026
itsmedreamwalker
0
540
Geminiをパートナーに神社DXシステムを個人開発した話(いなめぐDX 開発振り返り)
fujiba
0
140
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
170
Nuxt Server Components
wattanx
0
250
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
440
The browser strikes back
jonoalderson
0
900
Building the Perfect Custom Keyboard
takai
2
720
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
760
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
300
Chasing Engaging Ingredients in Design
codingconduct
0
160
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.5k
Design in an AI World
tapps
0
190
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
200
Why Our Code Smells
bkeepers
PRO
340
58k
Automating Front-end Workflow
addyosmani
1370
200k
What's in a price? How to price your products and services
michaelherold
247
13k
Transcript
Kotlin 2.0 ਸ ా೧ ঌইࠁח Kotlin ې Leonardo YongUk
Kim 2023.05
2 Contents 01 02 03 04 05 Kotlin 2.0 ߂
୶оੋ য ച Kotlin Multiplatform Compose for iOS Compose for Desktop Compose for Web
1. Kotlin 2.0 ߂ ୶оੋ য ച
,ࣁ҅ীࢲفߣ૩۽֫,PUMJOীبੑغחۿূ٘
5 K2 ஹੌ۞ بੋ ۿূ٘ ೱ࢚ https://blog.jetbrains.com/ko/kotlin/2023/04/kotlinconf-2023-opening-keynote/
6 ۿূ٘৬ ߔূ٘о ޖੋоਃ? ۿ ূ٘ ࢲ৬ दݭ౮ গօۄ۽ ҳࢿ.
ࣗझ٘ܳ ੍য ҳޙ ܻܳ ٜ݅Ҋ ࠁܳ ୶оೣ. ߔূ٘ р ٘ ࢤࢿ & ୭ചӝ৬ ݠन ٘ ࢤࢿ ୭ ച۽ ա־য. ୭ചܳ ೞҊ ӝ҅য ٘ա ఋѶ ٘ܳ ࢤࢿ. ౣܽ ҃ীח ߄ Bytecodeա LLVM Bitcodeо ఋѶ. ౣܽ ౣܽ ҃ী (1.3ө) р ٘ ࢤࢿ & ୭ ചӝо হ. ബਯࠁח ౣܽ য ߊ ؊ ਃ೮. (ӝࣿࠗ) https://twitter.com/kotlin
7 ߔূ٘ী IR بੑ IR ߔূ٘ীࢲ ҕਬೞח р ࣻળ য
IR generator & optimizer IRਸ ٜ݅Ҋ ୭ച ೞח . ౣܽ ֎౭࠳ܳ ٜ݅ݴ ࢜܂ѱ ୶о. റ JVM(1.5)җ JS(1.6)ਸ IRਸ ॳب۾ ࢿ. ҕాੋ ୭ചܳ ೡ ࣻ . (Ӓө ח ߔূ٘݃ ߹ب۽ ࢿ.) بೞח ঋও݅ ࢜ ߔূ٘ ࢿמ ೱ࢚! https://twitter.com/kotlin
թ Ѫ ۿূ٘ ۨѢद PSI (Program Structure Interface) PSI Program
Structure Interface ౣܽ ٘ܳ यೠ Ѿҗ ܻ. IntelliJীࢲ ݢ ॳ؍ ҳઑܳ ౣܽ ஹੌ۞ب ରਊ. ࣗझ ٘৬ Ѣ غח ױࣽೠ ഋక.
PSIViewer۽ PSIܳ ഛੋ оמ
ܳ ח BindingContext Kotlin Compiler In past, 1.4 and beyond
ܳ ח BindingContext Kotlin Compiler In past, 1.4 and beyond
ܳ ח BindingContext Kotlin Compiler In past, 1.4 and beyond
PSI + BindingContextо ޙઁо աਃ? ୭ച ۿূ٘ ࣻળীࢲ PSIীࢲ ୭ചܳ
ೞח Ѫ औ ঋ. ޙݓ ߹ب BIndingContextী ח Ѫب ୭ചী જ ޅೣ. நए झ BindingContextо Ѣೠ Mapযࢲ நए ബਯী જ ޅೣ.
Frontend Intermediate Representation ߔূ٘ীѱ ׳ೡ ࢜۽ р য https://twitter.com/kotlin
Kotlin FIR Viewer FIRਸ ࠅ ࣻ ח ࠭য https://github.com/google/Kotlin-FirViewer
Kotlin Compiler In past, 1.4 and beyond
ۿূ٘ ৵ FIR فѐо աਃ? ࢲ 3BX'*3࠽؊ "OBMZ[F ழ झܻ
'*3 '*3 ױ Lowering ױࣽച(simplify)ۄҊ ࢸݺ. ٣गѢ݂(Desugraing)ۄҊب അ. ࠺ҳઑച (Desctructure)ܳ োࣘػ ੑਵ۽ ߸҃. for ١ਸ whileਵ۽ ߸҃. ো(+, +=, in, …)١ਸ ݺदੋ ഐ۽ ߸ഋ. ӝఋ ۿূ٘ ࣻળীࢲ ୭ചب ࣻ೯.
18 FIR ӝ߈ ۿূ ஹੌ۞ ࢿמ FIR ӝ߈ਵ۽ ݅ٚ
ۿূ٘ח PSI + BindingContext ӝ߈ ۿূ٘ ࠁ ഻न ࡅܴ. IDE IDEب ۿূ٘ܳ ҕਬ. ੋభܻઁীࢲ ܳ ঈೞҊ ٘ ೞۄ, ࠙ࢳೞח ࣘبо ࡈۄ. Kotlin IDE ۞Ӓੋ ࢿ.
19 о ݆ ਃ߉ ӝמ Static Extensions ੋझఢझо ইפ؊ۄب ഛ
ೣࣻܳ ٜ݅ ࣻ . Collection Literals listOf, mapOf, setOf о ইצ ܻఠۡ۽ ஸ۩࣌. Name-based Destructuring ࠺ҳઑച(ҳઑ࠙೧)ܳ ਤ ӝ߈ ইפۄ ܴ ӝ߈ਵ۽. Explicit Fields э ஶࣆ private, public ۽ಌ౭ܳ ٜ݅ ঋইب ؽ. Context Receivers ݯߡ ഛ ೣࣻ ৻ী Contextܳ ೡ ߑߨ ୶о.
20 ഛ (Static Extensions) https://youtrack.jetbrains.com/issue/KT-11968 File.open("data.txt")
21 ഛ (Static Extensions) https://youtrack.jetbrains.com/issue/KT-11968 File.open("data.txt") fun File.Companion.open(name: String)
22 ഛ (Static Extensions) https://youtrack.jetbrains.com/issue/KT-11968 File.open("data.txt") fun File.Companion.open(name: String)
23 ഛ (Static Extensions) https://youtrack.jetbrains.com/issue/KT-11968 File.open("data.txt") fun File.Static.open(name: String)
24 ஸ۩࣌ ܻఠۡ (Collection Literals) https://youtrack.jetbrains.com/issue/KT-43871 cmdArgs = listOf("-language-version", "2.0")
25 ஸ۩࣌ ܻఠۡ (Collection Literals) https://youtrack.jetbrains.com/issue/KT-43871 cmdArgs = [“-language-version", “2.0"]
26 ஸ۩࣌ ܻఠۡ (Collection Literals) https://youtrack.jetbrains.com/issue/KT-43871 cmdArgs = [“-language-version", “2.0”]
val skip = persistentSetOf<Int>(0, 1)
27 ஸ۩࣌ ܻఠۡ (Collection Literals) https://youtrack.jetbrains.com/issue/KT-43871 cmdArgs = [“-language-version", “2.0”]
val skip: PersistentSet<Int> = [0, 1]
28 ஸ۩࣌ ܻఠۡ (Collection Literals) https://youtrack.jetbrains.com/issue/KT-43871 cmdArgs = [“-language-version", “2.0”]
val skip = PersistentSet [0, 1]
29 ܴ ӝ߈ ࠺ҳઑച (Name-Based Restructuring) https://youtrack.jetbrains.com/issue/KT-19627 data class Person(
val fi rstName: String, val lastName: String )
30 ܴ ӝ߈ ࠺ҳઑച (Name-Based Restructuring) https://youtrack.jetbrains.com/issue/KT-19627 EBUBDMBTT1FSTPO WBM
fi STU/BNF4USJOH WBMMBTU/BNF4USJOH WBM fi STU/BNF MBTU/BNF QFSTPO
31 ܴ ӝ߈ ࠺ҳઑച (Name-Based Restructuring) https://youtrack.jetbrains.com/issue/KT-19627 EBUBDMBTT1FSTPO WBM
fi STU/BNF4USJOH WBMMBTU/BNF4USJOH WBM MBTU/BNF fi STU/BNF QFSTPO
32 ஶఖझ ࣻन (Context Receivers) https://youtrack.jetbrains.com/issue/KT-10468 fun process( context: ServiceContext,
request: ServiceRequest ) { val data = request.loadData(context) }
33 ஶఖझ ࣻन (Context Receivers) https://youtrack.jetbrains.com/issue/KT-10468 fun process( context: ServiceContext,
request: ServiceRequest ) { val data = request.loadData(context) } context(ServiceContext) fun processRequest(request: ServiceRequest)
34 ஶఖझ ࣻन (Context Receivers) https://youtrack.jetbrains.com/issue/KT-10468 context(ServiceContext) fun processRequest(request: ServiceRequest)
{ val data = request.loadData() // }
35 ஶఖझ ࣻन (Context Receivers) https://youtrack.jetbrains.com/issue/KT-10468 context(ServiceContext) fun processRequest(request: ServiceRequest)
{ val data = request.loadData() // } context(ServiceContext) fun ServiceRequest.loadData(): Data
36 ݺद ٘ (Explicit Fields) https://youtrack.jetbrains.com/issue/KT-14663 private val _applicationState =
MutableStateFlow(State()) val applicationState: StateFlow<State> get() = _applicationState
37 ݺद ٘ (Explicit Fields) https://youtrack.jetbrains.com/issue/KT-14663 private val _applicationState =
MutableStateFlow(State()) val applicationState: StateFlow<State> get() = _applicationState val applicationState: StateFlow<State> fi eld = MutableStateFlow(State())
38 ؘఠۨ https://github.com/kotlin/dataframe val df = DataFrame.readCSV("KotlinSO.csv")
39 ؘఠۨ https://github.com/kotlin/dataframe val df = DataFrame.readCSV("KotlinSO.csv") val kmp =
df. fi lter { tags?.contains("multiplatform") ?: false }
40 K2 ۿূ٘ীࢲח ۞Ӓੋਸ ਊೞӝ एਕࢲ ೧Ѿ val df =
DataFrame.readCSV("KotlinSO.csv") val kmp = df. fi lter { tags?.contains("multiplatform") ?: false } kmp.add("years") { creationData.year } .groupBy { year } .count()
41 ؘఠۨ
2. Kotlin Multiplatform
43 ݒ֙ ݣ౭ۖಬ ۄ࠳۞ܻח ૐо.
44 ౣܽ ݣ౭ۖಬ ই ߬ఋ ױ҅
45 Kotlin Multiplatform ۄ࠳۞ܻ
46 Kotlin Multiplatform Mobileਸ ਤ೧ ਃೠ Ѫ Android Studio ݣ౭ۖಬ
গܻா࣌ਸ ٜ݅Ҋ दޛۨఠա ೞ٘ਝযܳ प೯.
47 Kotlin Multiplatform Mobileਸ ਤ೧ ਃೠ Ѫ Xcode Xcodeח ߔӒۄ٘ীࢲ
ࣻ೯ ؽ. Kotlin/Nativeо ઓೞח ߡਸ ࢸ೧ঠ ೣ.
48 Kotlin Multiplatform Mobileਸ ਤ೧ ਃೠ Ѫ Kotlin Multiplatform Mobile
উ٘۽٘ झౚ٣য়ীࢲ Kotlin Multiplatform Mobile ۞Ӓੋ ࢸ.
49 Kotlin Multiplatform Mobileਸ ਤ೧ ਃೠ Ѫ JDK Android Studioী
೧ ࢸ. Kotlin Plugin Android Studioী ࢸ. সؘܳ ೧ࢲ ߡਸ ୭नച ೧ঠ.
50 Kotlin Multiplatform Mobileਸ ਤ೧ ਃೠ Ѫ KDoctor KMMਸ ਤ೧
ਃೠ ജ҃ ח Ѩೞח জ.
51
52 Kotlin Multiplatform Mobileਸ ਤ೧ ਃೠ Ѫ CocoaPods KMM SPM(SwiftPackageManager)ܳ
ਗೞ ঋ. ( ৵!)
53 Kotlin Multiplatform Appਵ۽ ࢜ ۽ંܳ ݅ٞ.
54 ಁః ֎ উ٘۽٘/߄ জۢ بݫੋ ࣽਵ۽ ೣ.
55 জ ֎ ӝࠄਵ۽ androidApp, iosApp, shared۽ জ ֎ ೧.
iOS framework distribution Regular۽ Cocoapods -_-ਸ ࢶఖೡ ࣻ .
56 androidApp উ٘۽٘ ҙ۲ ٘ח androidApp ইې ਤೣ
57 উ٘۽٘ח Compose۽ ࢤࢿ ؽ
58 iosApp iOS ҙ۲ ٘ח iOSAppী ਤೣ.
59 iOSח SwiftUI۽ Compose ইתפ.
60
61 ߡ ܻח যڌѱ ೮ਸөਃ? expect৬ actual shared/src/ commonMain iOS৬
Androidীࢲ ݽف ࢎਊೡ ੋఠಕझܳ expect ఃਕ٘۽ ݅ٞ.
62 ߡ ܻח যڌѱ ೮ਸөਃ? expect৬ actual shared/src/ androidMain Android
ҳഅਸ actual ఃਕ٘ܳ ࠢৈ ҳഅ
63 ߡ ܻח যڌѱ ೮ਸөਃ? expect৬ actual shared/src/ iOSMain iOS
ҳഅਸ actual ఃਕ٘ܳ ࠢৈ ҳഅ
64 KMM for iOSীࢲ ݅աѱ غח ࢚ടٜ ObjC അ Kotlin
ObjC݅ ਗ೧ࢲ ઁցܼ ېझ݅ ਗೞҊ ੋఠಕझܳ ਗೞ ޅೣ. Abstract classܳ न ࢎਊ೧ঠ ೣ. @HinddenFromObjC, @ObjcName ఃਕ٘ܳ ӓਵ۽ ഝਊೞ. @ObjcName(swiftName=“_”) _ח ౠࣻೠ ఃਕ٘. plane.fuel(volume: .Gallos(gallos: 12.5)) न plane.fuel(.Gallons(12.5)) ӝਵ۽ח ܽ Swiftܳ ߄۽ ఋѱೡ Ѫ. Swiftܳ ObjeCܳ ઁ৻ೞҊ ߄ੋ٘ೡ ࣻ হӝী ߊ ࢤೠ ޙઁ. SourceKitten৬ э بҳٜ۽ р ٘ܳ ࢤࢿೞ. ۄੋ ؘݫী ѻ য۰ Suspend suspendח ߔ(completion handler) غҊ ߔ Swiftীࢲ async۽ ഐ оמೞ݅ ஂࣗо ࠛ оמೣ. Flowب ੜ ਗغ ঋ. KMP-NativeCoroutines ۄ࠳۞ܻܳ ഝਊ೧ঠ ೣ. https://github.com/rickclephas/KMP-NativeCoroutines ౣܽ ৻о झਤ ೩ٜ۞ ׳ غ ঋਸ ࣻ য @Throws ఃਕ٘۽ Errorܳ ೧ঠ ೣ.
65 KMM for iOSীࢲ ݅աѱ غח ࢚ടٜ CocoaPods ই ҕधਵ۽
SPM(Swift Package Manager)ܳ ਗೞ ঋ. Gradle API ࣻળীࢲ ܻػ റ ী ਗೠҊ ೣ. (ઁ?) CocoaPodsח ઓࢿਸ ࣗझ۽ оઉ৬ э ࠽٘ী ࢎਊೞӝী ݒ ࠺ബਯ. TouchLab ۄ࠳۞ܻ KMMBridgeܳ ࢎਊद. https://github.com/touchlab/KMMBridge SPMਸ ೞӝ ਤ೧ࢲח Git ܻನషܻ৬ झక౮ ੌ ࣗо ਃೞ. (AWS?) Frozen Global Objectח ӝࠄਵ۽ frozen. Ӕೡ ࣻ ݅ ߸҃ೡ ࣻ হ. @ThreadLocalਸ ࠢݶ freeze ഐ উೣ. Atomicೠ ܐҳઑ ࢎਊ ਃೡ ࣻ . freeze() ഛ ೣࣻܳ ਊ೧ ؘఠܳ ܾ ࣻ Ҋ ಽ ࣻח হ. Global ۽ಌ౭ח ݫੋझۨ٘ীࢲ݅ ࠅ ࣻ .
66 KMM for iOSীࢲ ݅աѱ غח ࢚ടٜ Memory Management झఖ
ۨझ ٣ߡӦ য۵Ҋ, ݫݽܻ ݒפݢо ই উח ঋ. https://youtrack.jetbrains.com/issue/KT-55512 ଵҊ Kotlin Multiplatform Mobileਸ ഝਊೠ ؘ݃ী ٘ۄߡজ ѐߊ ঠӝ Kotlin/Multiplatform for iOS developers : state & future by Salomon Brys
3. Compose for iOS
68 Compose Multiplatform mobile application మ݁ਸ ਊ೧ࢲ द೧ঠ మ݁ https://github.com/JetBrains/compose-multiplatform-ios-android-template
69 Compose for iOSܳ ਤ೧ ਃೠ Ѫ Android Studio Android
জҗ iOS জܳ प೯ೡ ࣻ ח ѐߊ ജ҃. Xcode Xcodeח ߔӒۄ٘ীࢲ ࣻ೯ ؽ. Kotlin/Nativeо ઓೞח ߡਸ ࢸ೧ঠ ೣ. Kotlin Multiplatform Mobile উ٘۽٘ झౚ٣য়ীࢲ Kotlin Multiplatform Mobile ۞Ӓੋ ࢸ. CocoaPods Compose for iOSب SPM(SwiftPackageManager)ܳ ਗೞ ঋ.
70 Compose for iOSܳ ਤ೧ ਃೠ Ѫ
71 shared/src/ commonMain
72 androidApp/ src/ commonMain
73 iosApp/ iosApp
74 iosApp/ iosApp
75 sharedApp/ src/iosMain
76 ߸҃೧ࠁח Compose for iOS TextField ୶о TextFieldܳ ୶оೞח
ؘݽܳ द.
4. Compose for Desktop
78 Compose for Desktop ౠ Cross- Platform ݣ౭ۖಬ ইצ ۽झۖಬਵ۽
࠙ܨ. JVM ఋѶҊ JVM ؋ী ৈ۞ ۖಬীࢲ بח Ѫਸ ۽झۖಬਵ۽ ࢸݺ. SKIKO SKIA ౣܽ ߄ੋ٬ SKIKOী ೧ ۪؊݂. https://github.com/JetBrains/skiko SKIA ಪ ۪؊݂ ઁ ݃ ׳ۄ झܽ ࢫ పझܳ ೞ ݈. Compose Multiplatform IDE support ੋభܻઁ ই٣যա উ٘۽٘ झౚ٣য়ী ࢸ. https://plugins.jetbrains.com/plugin/16541-compose-multiplatform-ide-support IntelliJ IDEA ੋభܻઁ ই٣য 2020.3 ࢚ীࢲ ࢎਊоמ.
79 Compose for Desktop ౠ ଵҊ࢚ You can do desktop
too! By Victor Kropp https://www.youtube.com/watch?v=Mgf_9kxM1BA JDK 15 JDK11ਵ۽ ۽ં ࢤࢿ оמ. ֎౭࠳ ߓನ ಁఃਸ ਤ೧ࢲח 15 ࢚.
80 Compose Multiplatform desktop application New Project۽ दೞӝ
81
82
5. Compose for Web
84 Compose for Web ౠ WebAssembly JavaScriptܳ ॳ ঋҊ WebAssembly۽
प೯. Kotlin/WASM ఋѶ. Compose HTML HTMLਸ ࢤࢿೞח Kotlin/JS ۄ࠳۞ܻب . Compose for Webҗ ޖҙ. Compose Multiplatform IDE support ੋభܻઁ ই٣যա উ٘۽٘ झౚ٣য়ী ࢸ. https://plugins.jetbrains.com/plugin/16541-compose-multiplatform-ide-support IntelliJ IDEA ੋభܻઁ ই٣য 2020.3 ࢚ীࢲ ࢎਊоמ.
85 WASM ઁ https://github.com/Kotlin/kotlin-wasm-examples
86
87