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
Data Essentials in SwiftUI
Search
ry-itto
July 09, 2020
Programming
1
450
Data Essentials in SwiftUI
集まれSwift好き!Swift愛好会スピンオフ WWDC20セッション要約会 @オンライン
ry-itto
July 09, 2020
Tweet
Share
More Decks by ry-itto
See All by ry-itto
決定版!?OSSアプリプロジェクトでのBeta版アプリ配布の方法「Xcode Cloud + TestFlight」
ryitto
0
300
CA.swift#14
ryitto
3
5.1k
swift-argument-parserで 簡単 CLI ツール作り
ryitto
1
120
Composable Architecture
ryitto
0
720
CollectionViewの 新しいレイアウトの作り方
ryitto
0
47
Swift5.1 SwiftUI
ryitto
0
120
Other Decks in Programming
See All in Programming
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
950
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
6
700
Fixstars高速化コンテスト2024準優勝解法
eijirou
0
190
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
180
“あなた” の開発を支援する AI エージェント Bedrock Engineer / introducing-bedrock-engineer
gawa
4
220
ドメインイベント増えすぎ問題
h0r15h0
2
570
선언형 UI에서의 상태관리
l2hyunwoo
0
270
Оптимизируем производительность блока Казначейство
lamodatech
0
950
DevinとCursorから学ぶAIエージェントメモリーの設計とMoatの考え方
itarutomy
0
150
DMMオンラインサロンアプリのSwift化
hayatan
0
190
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
1.2k
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
300
Featured
See All Featured
The Language of Interfaces
destraynor
155
24k
The Cost Of JavaScript in 2023
addyosmani
46
7.2k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
A better future with KSS
kneath
238
17k
A Philosophy of Restraint
colly
203
16k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
BBQ
matthewcrist
85
9.4k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
GitHub's CSS Performance
jonrohan
1030
460k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
GraphQLとの向き合い方2022年版
quramy
44
13k
Transcript
3ZPZB*UP !SZJUUP %BUB&TTFOUJBMTJO4XJGU6* ू·Ε4XJGU͖ʂ4XJGUѪձεϐϯΦϑ88%$ηογϣϯཁձ!ΦϯϥΠϯ
ࣗݾհ ҏ౻྇ !SZJUUP ձେֶֶ෦ੜ Χϐόϥ͕͖
ηογϣϯͷ༰ w 4XJGU6*Ͱͷσʔλϑϩʔ w ΞϓϦͷσʔλϞσϧઃܭ w ࣮ࡍʹΞϓϦʹऔΓೖΕΔࡍͷςΫχοΫ
ηογϣϯͷ༰ w 4XJGU6*Ͱͷσʔλϑϩʔ w ΞϓϦͷσʔλϞσϧઃܭ w ࣮ࡍʹΞϓϦʹऔΓೖΕΔࡍͷςΫχοΫ
4XJGU6*Ͱͷσʔλϑϩʔ ϏϡʔΛ࡞Δ࣌ʹߟ͍͑ͨ̏ͭͷ࣭ w ࡞͢ΔϏϡʔͰඞཁͳσʔλԿ͔ʁ w ࡞͢ΔϏϡʔͰσʔλΛͲͷΑ͏ʹૢ࡞͢Δ͔ʁ w σʔλͲ͔͜ΒདྷΔʢ͞ΕΔʣͷ͔ʁ
4XJGU6*Ͱͷσʔλϑϩʔ ϏϡʔΛ࡞Δ࣌ʹߟ͍͑ͨ̏ͭͷ࣭ w ࡞͢ΔϏϡʔͰඞཁͳσʔλԿ͔ʁ CPPLͱ͍͏#PPLܕͷ QSPHSFTTͱ͍͏%PVCMFܕͷ ͦΕͧΕ͕͋ΕϏϡʔΛදࣔͰ͖ͦ͏ɻ w ࡞͢ΔϏϡʔͰσʔλΛͲͷΑ͏ʹૢ࡞͢Δ ͔ʁ
ಛʹͳͦ͞͏ w σʔλͲ͔͜ΒདྷΔʢ͞ΕΔʣͷ͔ʁ ͜ͷϏϡʔΛ͏ϏϡʔͰ͞ΕΔ͜ͱʹͳΓͦ͏ɻ struct BookCard : View { let book: Book let progress: Double var body: some View { HStack { Cover(book.coverName) VStack(alignment: .leading) { TitleText(book.title) AuthorText(book.author) } Spacer() RingProgressView(value: progress) } } }
4XJGU6*Ͱͷσʔλϑϩʔ ϏϡʔΛ࡞Δ࣌ʹߟ͍͑ͨ̏ͭͷ࣭ w ࡞͢ΔϏϡʔͰඞཁͳσʔλԿ͔ʁ CPPLͱ͍͏#PPLܕͷ QSPHSFTTͱ͍͏%PVCMFܕͷ ͦΕͧΕ͕͋ΕϏϡʔΛදࣔͰ͖ͦ͏ɻ w ࡞͢ΔϏϡʔͰσʔλΛͲͷΑ͏ʹૢ࡞͢ Δ͔ʁ
ಛʹͳͦ͞͏ w σʔλͲ͔͜ΒདྷΔʢ͞ΕΔʣͷ͔ʁ ͜ͷϏϡʔΛ͏ϏϡʔͰ͞ΕΔ͜ͱʹͳΓͦ͏ɻ struct BookCard : View { let book: Book let progress: Double var body: some View { HStack { Cover(book.coverName) VStack(alignment: .leading) { TitleText(book.title) AuthorText(book.author) } Spacer() RingProgressView(value: progress) } } } l4PVSDFPG5SVUIzͱ͍͏ݴ༿ͰηογϣϯͰѻΘΕΔ
4XJGU6*Ͱͷσʔλϑϩʔ ϏϡʔͰͷσʔλอ࣋ɺͦΕͧΕͲΜͳ࣌ʹ͏ʁ ϓϩύςΟϏϡʔʹΑͬͯมߋ͞Εͳ͍σʔλ !4UBUFϏϡʔʹΑͬͯอ࣋͞ΕΔҰ࣌తͳσʔλΛѻ͏ !#JOEJOHଞͷϏϡʔʹΑͬͯอ࣋͞Ε͍ͯΔσʔλΛมߋ͍ͨ͠߹
ηογϣϯͷ༰ w 4XJGU6*Ͱͷσʔλϑϩʔ w ΞϓϦͷσʔλϞσϧઃܭ w ࣮ࡍʹΞϓϦʹऔΓೖΕΔࡍͷςΫχοΫ
ΞϓϦͷσʔλϞσϧઃܭ σʔλϞσϧఆٛ w 0CTFSWBCMF0CKFDUΛ͏ w !1VCMJTIFEΛ͏ w ̎ͭͷ࣭ ࡞͢ΔϏϡʔͰσʔλΛͲͷΑ͏ʹૢ࡞͢ Δ͔ʁ
ʹ͑Δͷ༰қ class CurrentlyReading: ObservableObject { let book: Book @Published var progress = ReadingProgress() @Published var isFinished = false var currentProgress: Double { isFinished ? 1.0 : progress.progress } }
ΞϓϦͷσʔλϞσϧઃܭ ϏϡʔͰ࡞ͬͨϞσϧΛ͏ w ଞͷ̎ͭͷ࣭ʹ͍ͭͯʁ w ࡞͢ΔϏϡʔͰඞཁͳσʔλԿ͔ʁ w ࡞͢ΔϏϡʔͰσʔλΛͲͷΑ͏ʹૢ࡞͢Δ͔ʁ w σʔλͲ͔͜ΒདྷΔʢ͞ΕΔʣͷ͔ʁ
ΞϓϦͷσʔλϞσϧઃܭ ϏϡʔͰ࡞ͬͨϞσϧΛ͏ w ѻ͏ͨΊͷ1SPQFSUZ8SBQQFS͕̏ͭ w !0CTFSWFE0CKFDU w !&OWJSPONFOU0CKFDU w !4UBUF0CKFDU
/FX
ΞϓϦͷσʔλϞσϧઃܭ ϏϡʔͰ࡞ͬͨϞσϧΛ͏ !0CTFSWFE0CKFDU σʔλͷґଘؔΛ࡞Δ !&OWJSPONFOU0CKFDU Ϗϡʔ֊ؒͷ0CTFSWBCMF0CKFDUͷѻ͍Λศརʹ͢Δ !4UBUF0CKFDU /FX 0CTFSWBCMF0CKFDUΛϏϡʔͷϥΠϑαΠΫϧʹ݁ͼ͚ͭΔ
ηογϣϯͷ༰ w 4XJGU6*Ͱͷσʔλϑϩʔ w ΞϓϦͷσʔλϞσϧઃܭ w ࣮ࡍʹΞϓϦʹऔΓೖΕΔࡍͷςΫχοΫ
࣮ࡍʹΞϓϦʹऔΓೖΕΔࡍͷςΫχοΫ w ࢠͷϏϡʔͰϞσϧΛϓϩύςΟͰ ͍࣋ͬͯͯɺͦ͜ͰॳظԽ͍ͯ͠Δ ߹ w 3FBEJOH-JTU7JFXFS͕ࡍϨϯμϦϯά͞ ΕΔͨͼʹϞσϧͷΠϯελϯε͕ੜ ͞Εͯ͠·͏
struct ReadingListViewer: View { var body: some View { NavigationView { ReadingList() Placeholder() } } } struct ReadingList: View { @ObservedObject var store = ReadingListStore() var body: some View { // ... } }
࣮ࡍʹΞϓϦʹऔΓೖΕΔࡍͷςΫχοΫ ղܾࡦ w !4UBUF0CKFDUΛΘΓʹ͏͜ͱ Ͱղܾ͕Ͱ͖ΔʢΒ͍͠ʣ w !4UBUF0CKFDUΛ༻͢Δͱ4XJGU6*͕ దͳλΠϛϯάͰΠϯελϯεԽΛ͠ ͯ͘ΕΔͱͷ͜ͱ struct
ReadingListViewer: View { var body: some View { NavigationView { ReadingList() Placeholder() } } } struct ReadingList: View { @StateObject var store = ReadingListStore() var body: some View { // ... } }
࣮ࡍʹΞϓϦʹऔΓೖΕΔࡍͷςΫχοΫ ୭͕σʔλΛ࣋ͭͷ͔ w ڞ௨ͷઌʹ࣋ͭ w !4UBUF0CKFDUΛͬͯͦͷϏϡʔ͕ࣗ࣋ͭ w ΞϓϦͷάϩʔόϧͳσʔλͱͯ࣋ͭ͠ w "QQΛܧঝͨ͠Ϗϡʔʹ!4UBUFͳͲΛར༻ͯ͠એݴͯ͋͛͠Δ
࣮ࡍʹΞϓϦʹऔΓೖΕΔࡍͷςΫχοΫ σʔλͷӬଓԽ w 4DFOF4UPSBHF w 4XJGU6*͕ཧ͍ͯ͠ΔϏϡʔͰ͔͑͠ͳ͍ w ߲ͷબঢ়ଶͳͲΛอଘ w "QQ4UPSBHF
w 6TFS%FGBVMUΛ༻ͨ͠άϩʔόϧετϨʔδ w ઃఆͳͲͷখ͞ͳσʔλΛอଘ
͓·͚ ৽͘͠Ճ͞ΕͨΠϕϯτιʔε w PO$IBOHF w PO0QFO63- w PO$POUJOVF6TFS"DUJWJUZ