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
SwiftUI Performance 不要なViewの再描画と更新を抑える
Search
Hiroshi Hosoda
April 01, 2024
Programming
1.5k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SwiftUI Performance 不要なViewの再描画と更新を抑える
Hiroshi Hosoda
April 01, 2024
Transcript
18 slides
© 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 ご静聴ありがとうございました
Other Decks in Programming
See All in Programming
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
310
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
190
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
170
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
390
まずはコードより業務と向き合う:テーブル解体のためにPdMを呼んだ話
sakawe_ee
0
260
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
690
Coding with AI: How to trust the storyteller (AWS Community Day Adria, Ljubljana 2026)
slobodan
0
150
私なりのハーネスエンジニアリング ~独自の言語処理系の開発を通して~
seosoft
0
230
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
220
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
150
protojson における文字化けの扱い
kazuki1023
0
450
Debian JP Projectのサーバー構成
uwabami
1
150
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
22k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
390
Docker and Python
trallard
47
4.3k
Odyssey Design
rkendrick25
PRO
3
960
Music & Morning Musume
bryan
48
7.5k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
360
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
490
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
480
How to train your dragon (web standard)
notwaldorf
96
6.9k
A better future with KSS
kneath
240
18k