Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Demystify SwiftUI 要約 / Summary of Demystify Swi...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Elvis Shi
June 28, 2021
Programming
750
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Demystify SwiftUI 要約 / Summary of Demystify SwiftUI
Elvis Shi
June 28, 2021
More Decks by Elvis Shi
See All by Elvis Shi
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
570
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
570
ゼロから始めるPreferenceの実装 / Let's implement Preferences from scratch
lovee
0
160
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
410
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
790
How did I build an Open-Source SwiftUI Toast Library
lovee
1
190
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
1.3k
SwiftUIで二重スクロール作ってみた / When I tried to make a dual-scroll-ish view in SwiftUI
lovee
1
390
Observation のあれこれ / A brief introduction about Observation
lovee
3
460
Other Decks in Programming
See All in Programming
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.1k
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
340
すこし踏み込む CancellationToken
htkym
2
1.7k
Are APIs Still Relevant in the AI Era?
soyuka
0
460
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
390
R8 の設定見直しでアプリサイズ削減
andpad
0
210
Simple Storage Service(S3) is not simple
iwatsukayura
0
270
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
650
Jetpack Compose Mechanisms
skydoves
2
730
Event is what happens
moro
1
300
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
230
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.2k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
730
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
560
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
Un-Boring Meetings
codingconduct
0
450
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
880
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
300
エンジニアに許された特別な時間の終わり
watany
109
250k
Product Roadmaps are Hard
iamctodd
55
13k
Transcript
%FNZTUJGZ4XJGU6*ཁ f o r : 6 . & .
* T X J G U G F BU ) " , "5" T X J G U ʙ 8 8 % $ 3F DBQ ʙ
} var employedBy = "YUMEMI Inc." var job = "iOS
Tech Lead" var favoriteLanguage = "Swift" var twitter = "@lovee" var qiita = "lovee" var github = "el-hoshino" var additionalInfo = """ ΠψͰ͕͢ɺԿ͔ʁ """ final class Me: Developable, Talkable {
˞ೣͰྫΛ্͍͛ͯ·͕͢ɺൃදऀΠψͰ͢ɻ
࣌ؒ ҧ͏࣌ؒͷ ಉ͡ೣʁ
࣌ؒ ͦͦ ҧ͏ೣʁ
ࣸਅ͚ͩͰஅ͕Ͱ͖ͳ͍ w ҧ͏ೣͰͱͯࣅͯΔ͔͠Εͳ͍ w ಉ͡ೣͰ࣌ظʹΑͬͯݟ͕ͨҧ͏͔͠Εͳ͍ w அ͢ΔͨΊʹՃͷใ͕ඞཁ w ໊લ w
࠼ w FUD *EFOUJUZ
4XJGU6*Λཧղ͢ΔͨΊͷେϙΠϯτ w *EFOUJUZ w -JGFUJNF w %FQFOEFODZ 4XJGU6*͕͋ͳͨͷࢥ͏௨Γͷಈ࡞Λ͍ͯ͠ͳ͔ͬͨΒɺ େ͜ΕΒͷѻ͍͕ؒҧ͍ͬͯΔ͔Βɻ
*EFOUJUZ w େϙΠϯτͷதͰҰ൪ॏཁ w -JGFUJNF%FQFOEFODZɺ*EFOUJUZ͕͋Δ͔Β ͦ͜Γཱͭ w 4XJGU6*ʹछྨͷ*EFOUJUZ͕͋Δ w &YQMJDJU*EFOUJUZʢ໌ࣔత*%ʣ
w 4USVDUVSBM*EFOUJUZʢߏత*%ʣ
&YQMJDJU*EFOUJUZ w ಈతʹมΘΔϏϡʔʹɺ ΤϯδχΞ͕͚ͭΔ*% w ର͕Identifiable ʹద߹͍ͯ͠ͳ͍߹ *%ͷKeyPathΛࢦఆ ͢Δඞཁ͕͋Δ ForEach(cats,
id: \.name) { cat in Text("\(cat.age)ࡀ") } Explicit Identity
&YQMJDJU*EFOUJUZʹٻΊΒΕΔੑ࣭ w ϢχʔΫੑ w ଞͷରͱඃ͍ͬͯ ͚ͳ͍ w ෆมੑ w ͍ͭɺԿճݺͼग़ͯ͠
มΘ͍͚ͬͯͳ͍ ForEach(cats, id: \.name) { cat in Text("\(cat.age)ࡀ") } Explicit Identity
4USVDUVSBM*EFOUJUZ w ߏʹΑͬͯࣗಈతʹ ͚ΒΕΔ*% w JGจTXJUDIจͷذ ͕͋ͬͨΒҧ͏*%͕ ͚ΒΕΔ Structural Identity
if flag { Text("A") } else { Text("B") }
4USVDUVSBM*EFOUJUZͱͷ͖߹͍ํ w ಉ͡ϏϡʔͳΒɺذΛ ͯ͠ߦ͚ͳ͍ w ذΛͤͣʹ͏·͘ *OFSU.PEJ fi FSͳͲΛ ׆༻
Structural Identity if flag { Text("A") } else { Text("B") } ద༻ͯ͠ϏϡʔͷඳըʹӨڹ͠ͳ͍.PEJ fi FSɻ PQBDJUZ QBEEJOH FUD
ͳͥ*EFOUJUZ͕ॏཁ͔ w "OJNBUJPO͢Δͱ͖ͳͲͷஅࠜڌ w Ҡಈ͖͔͢ΫϩεϑΣʔυ͖͔͢ w Ϗϡʔͷ-JGFUJNFΛܾΊΔࠜڌ w ඞཁͳ͘ͳͬͨΒϝϞϦ͔Βফ͢
-JGFUJNF w 4XJGU6*ͷϏϡʔλΠϓܕ w ϏϡʔλΠϓͨͩͷϏϡʔඳըϨγϐ w ϏϡʔλΠϓͷΠϯελϯεࣗମඇৗʹ໋ w ͔͠͠Ϗϡʔͷੜଘظؒͬͱ͍ w
Ϗϡʔඞཁ͕͋ͬͨΒੜ͞Εɺඞཁͳ͘ͳͬͨΒফ͞ΕΔ w ੜ͞ΕͨΒonAppearɺফ͞ΕͨΒonDisappear͕ݺ ΕΔ w @State@StateObjectϏϡʔ͕ඞཁͳ͘ͳͬͨΒফ ͞ΕΔ
-JGFUJNF fl BHUSVF UBQ ࣌ؒ fl BHGBMTF struct Demo:
View { var flag: Bool var body: some View { if flag { Counter() .background(Color.blue) } else { Counter() .background(Color.red) } } } struct Counter: View { @State private var count = 0 var body: some View { Text("\(count)") .onTapGesture { count += 1 } } } fl BHUSVF ফ͞ΕΔ
-JGFUJNF fl BHUSVF UBQ ࣌ؒ fl BHGBMTF struct Demo:
View { var flag: Bool var body: some View { Counter() .background( flag ? Color.blue : Color.red ) } } struct Counter: View { @State private var count = 0 var body: some View { Text("\(count)") .onTapGesture { count += 1 } } } fl BHUSVF ফ͞Εͳ͍ Dependency
%FQFOEFODZ w %FQFOEFODZͨͩͷϏϡʔͷೖྗ w @State@StateObject͚ͩͰͳ͘ɺ @Bindingͨͩͷvarશͯ%FQFOEFODZ w bodyҎ֎શͯ%FQFOEFODZͱߟ͑ͯͳ͍ w %FQFOEFODZ͕มΘͬͨΒɺͦΕʹඥͮ͘Ϗϡʔ͕
࠶ඳը͞ΕΔ w CPEZ͕ݺΕ࣮ͯߦ͞ΕΔ
%FQFOEFODZ 7JFX 7JFX 7JFX 7JFX %FQFOEFODZ %FQFOEFODZ %FQFOEFODZ
·ͱΊ w *EFOUJUZΛ੍͢Δͷ4XJGU6*Λ੍͢Δ w -JGFUJNFΛҙ͠ͳ͍ͱඞཁͳঢ়ଶ͕ফ͑ͯ͠·͏ w %FQFOEFODZͰ࠷ඳը͢ΔϏϡʔΛநग़͍ͯ͠Δ
ࢀߟ IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED