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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
540
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
540
ゼロから始めるPreferenceの実装 / Let's implement Preferences from scratch
lovee
0
160
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
400
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
770
How did I build an Open-Source SwiftUI Toast Library
lovee
1
180
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
450
Other Decks in Programming
See All in Programming
高専キャリア LT 発表内容
crysta1221
6
5.6k
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
110
スマート反転とウェブアクセシビリティ
camiha
0
180
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
160
What We Talk About When We Talk About XP
m_seki
2
490
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
140
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
650
巨大モノリシックアプリ モダン化大作戦
ktcryomm
0
860
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
120
Building an Out-of-Order CPU
latte72
1
750
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
1.1k
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
320
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
410
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
530
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
Writing Fast Ruby
sferik
630
63k
First, design no harm
axbom
PRO
2
1.3k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
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