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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Leonardo YongUk Kim
May 24, 2023
Programming
1
2.5k
Kotlin 2.0을 통해 알아보는 코틀린의 미래
라인 테크 토크에서 공유한 "코틀린 2.0을 통해 알아보는 코틀린의 미래" 발표 자료입니다.
Leonardo YongUk Kim
May 24, 2023
Tweet
Share
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
680
Compose Multiplatform 101
dalinaum
3
690
실리콘밸리 스타트업에서 일어난 일
dalinaum
0
160
AlphaGo에서 시작하는 인공지능
dalinaum
1
340
Zip: Data compression (20분만에 배우는 압축 알고리즘)
dalinaum
1
2.6k
안드로이드 빌드: 설탕없는 세계
dalinaum
0
160
Obfuscation 101 @ Naver Tech Concert
dalinaum
4
720
Realm은 어떻게 효율적인 데이터베이스를 만들었나?
dalinaum
1
700
MVC부터 MVVM, 단방향 데이터 흐름까지
dalinaum
5
930
Other Decks in Programming
See All in Programming
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.7k
Oxlintはいいぞ
yug1224
5
1.2k
Architectural Extensions
denyspoltorak
0
260
Pythonではじめるオープンデータ分析〜書籍の紹介と書籍で紹介しきれなかった事例の紹介〜
welliving
3
860
Package Management Learnings from Homebrew
mikemcquaid
0
170
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
490
AI時代の認知負荷との向き合い方
optfit
0
130
今から始めるClaude Code超入門
448jp
7
7.9k
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
950
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
390
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
5.9k
CSC307 Lecture 07
javiergs
PRO
0
530
Featured
See All Featured
Faster Mobile Websites
deanohume
310
31k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
420
Test your architecture with Archunit
thirion
1
2.1k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
420
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
310
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
610
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
810
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
GraphQLとの向き合い方2022年版
quramy
50
14k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Statistics for Hackers
jakevdp
799
230k
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