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.6k
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
730
Compose Multiplatform 101
dalinaum
3
710
실리콘밸리 스타트업에서 일어난 일
dalinaum
0
170
AlphaGo에서 시작하는 인공지능
dalinaum
1
350
Zip: Data compression (20분만에 배우는 압축 알고리즘)
dalinaum
1
2.7k
안드로이드 빌드: 설탕없는 세계
dalinaum
0
180
Obfuscation 101 @ Naver Tech Concert
dalinaum
4
730
Realm은 어떻게 효율적인 데이터베이스를 만들었나?
dalinaum
1
720
MVC부터 MVVM, 단방향 데이터 흐름까지
dalinaum
5
950
Other Decks in Programming
See All in Programming
Back to the roots of date
jinroq
0
780
t *testing.T は どこからやってくるの?
otakakot
1
920
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
380
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
560
20260514_its_the_context_window_stupid.pdf
heita
0
840
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
450
when storing skills in S3 file
watany
3
1.4k
空間オーディオの活用
objectiveaudio
0
140
UaaL×Androidアプリのメモリ計測 — Memory Profilerの先へ
rio432
0
140
PHPでバイナリをパースして理解するASN.1
muno92
PRO
0
430
認証統合から始めるフロントエンドの機能単位開発 — マイクロサービス思想の適用
koukimiura
0
100
Agent Skills を社内で育てる仕組み作り
jackchuka
1
1.8k
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
460
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.2k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
54k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
510
Darren the Foodie - Storyboard
khoart
PRO
3
3.3k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.2k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.3k
The SEO Collaboration Effect
kristinabergwall1
1
440
A designer walks into a library…
pauljervisheath
211
24k
Building AI with AI
inesmontani
PRO
1
980
Mind Mapping
helmedeiros
PRO
1
190
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