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
SwiftUI Performance 不要なViewの再描画と更新を抑える
Search
Hiroshi Hosoda
April 01, 2024
Programming
1.4k
1
Share
SwiftUI Performance 不要なViewの再描画と更新を抑える
Hiroshi Hosoda
April 01, 2024
Other Decks in Programming
See All in Programming
Nuxt Server Components
wattanx
0
270
How We Benchmarked Quarkus: Patterns and anti-patterns
hollycummins
1
120
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
180
「速くなった気がする」をデータで疑う
senleaf24
0
170
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
190
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
20
9.1k
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
5
2.5k
Vibe하게 만드는 Flutter GenUI App With ADK , 박제창, BWAI Incheon 2026
itsmedreamwalker
0
550
Running Swift without an OS
kishikawakatsumi
0
790
forteeの改修から振り返るPHPerKaigi 2026
muno92
PRO
3
280
iOS機能開発のAI環境と起きた変化
ryunakayama
0
180
Alternatives to JPA 2026
debop
0
110
Featured
See All Featured
The Limits of Empathy - UXLibs8
cassininazir
1
290
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
190
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
160
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
260
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
320
The Invisible Side of Design
smashingmag
302
51k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
370
Leo the Paperboy
mayatellez
7
1.6k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Thoughts on Productivity
jonyablonski
76
5.1k
Designing for humans not robots
tammielis
254
26k
Chasing Engaging Ingredients in Design
codingconduct
0
170
Transcript
© DMM © DMM CONFIDENTIAL SwiftUI Performance 不要なViewの再描画と更新を抑える
© DMM 自己紹介 • 細田大志 • 2019年 中途入社 • 動画配信開発部
• DMMTVの開発 2
© DMM 3 • Viewの再描画と更新の仕組み • Identity • Property •
Equatable • Viewの再描画と更新を抑える方法 • デバッグとInstruments アジェンダ
© DMM 4 • 再描画 • Viewを0から生成し直し表示する • ViewのIdentityが変化した場合 •
更新 • 必要なViewを更新して表示する • Viewのプロパティが変化した場合 Viewの再描画と更新
© DMM Identity SwiftUIはアプリの更新において同じか異なる要素かをIdentityによって認識 します。 SwiftUIには2種類のIdentityがあります。 • Explicit Identity •
Structural Identity 5
© DMM Explicit Identity 明示的な値によって管理されるIdentity。 6
© DMM Structural Identity View構造と型によって管理される 7
© DMM Property • @State • @StateObject • @ObservedObject •
@Binding • let • など 8
© DMM Equatable Viewが同値かによって更新するかを判定 9
© DMM 可能な限り分岐を統合する 可能な限りModifierを活用する 10
© DMM Viewには必要最低限な値を渡す プロパティが変更されると、View全体が更新される 11
© DMM Observation オブジェクトのプロパティをSwiftUIのViewが監視できるようになる。 12
© DMM Viewを分割する 複数のPropertyを持つViewのBodyを分割する 13
© DMM Viewを比較可能にする 14
© DMM ForEach ステーブルなidを使う 15
© DMM Debug • Self._printChanges • Viewが再描画または更新されるタイミングと要因を確認することができる • print(type(of: self.body))
• bodyの型情報を確認することができる 16
© DMM Instruments • Time Profiler • 実行された関数にかかった時間 • Hangs
• 応答していないメインスレッドを検 出し、対応するインターバルをハ ングの可能性があるものとしてラ ベル付けされる • View Body • 作成されたビューの数と作成にか かった時間 17
© DMM ご静聴ありがとうございました