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
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
630
Compose Multiplatform 101
dalinaum
3
640
실리콘밸리 스타트업에서 일어난 일
dalinaum
0
130
AlphaGo에서 시작하는 인공지능
dalinaum
1
300
Zip: Data compression (20분만에 배우는 압축 알고리즘)
dalinaum
1
2.4k
안드로이드 빌드: 설탕없는 세계
dalinaum
0
140
Obfuscation 101 @ Naver Tech Concert
dalinaum
4
560
Realm은 어떻게 효율적인 데이터베이스를 만들었나?
dalinaum
1
590
MVC부터 MVVM, 단방향 데이터 흐름까지
dalinaum
5
870
Other Decks in Programming
See All in Programming
AtCoder Heuristic First-step Vol.1 講義スライド(山登り法・焼きなまし法編)
takumi152
3
980
Coding Experience Cpp vs Csharp - meetup app osaka@9
harukasao
0
120
Let's Take a Peek at PHP Parser 5.x!
inouehi
0
100
複雑なフォームと複雑な状態管理にどう向き合うか / #newt_techtalk vol. 15
izumin5210
4
3.3k
DomainException と Result 型で作る型安全なエラーハンドリング
karszawa
0
150
AIエージェントを活用したアプリ開発手法の模索
kumamotone
1
750
GDG Super.init(version=6) - From Where to Wear : 모바일 개발자가 워치에서 발견한 인사이트
haeti2
0
560
20250326_生成AIによる_レビュー承認システムの実現.pdf
takahiromatsui
17
5.6k
PHPのガベージコレクションを深掘りしよう
rinchoku
0
240
令和トラベルにおけるコンテンツ生成AIアプリケーション開発の実践
ippo012
1
260
RCPと宣言型ポリシーについてのお話し
kokitamura
2
150
PHPによる"非"構造化プログラミング入門 -本当に熱いスパゲティコードを求めて- #phperkaigi
o0h
PRO
0
1.1k
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.5k
The Invisible Side of Design
smashingmag
299
50k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.2k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
29
2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
118
51k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.6k
Scaling GitHub
holman
459
140k
Embracing the Ebb and Flow
colly
85
4.6k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
31
4.8k
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