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
440
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
290
CA.swift#14
ryitto
3
5k
swift-argument-parserで 簡単 CLI ツール作り
ryitto
1
110
Composable Architecture
ryitto
0
710
CollectionViewの 新しいレイアウトの作り方
ryitto
0
47
Swift5.1 SwiftUI
ryitto
0
120
Other Decks in Programming
See All in Programming
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
5
900
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
php-conference-japan-2024
tasuku43
0
240
testcontainers のススメ
sgash708
1
120
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1k
たのしいparse.y
ydah
3
120
talk-with-local-llm-with-web-streams-api
kbaba1001
0
180
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
1
560
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
100
Featured
See All Featured
Making Projects Easy
brettharned
116
5.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Building Applications with DynamoDB
mza
91
6.1k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
97
Building an army of robots
kneath
302
44k
RailsConf 2023
tenderlove
29
940
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Navigating Team Friction
lara
183
15k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Code Reviewing Like a Champion
maltzj
520
39k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Thoughts on Productivity
jonyablonski
67
4.4k
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