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
Demystifying SwiftUI Previews
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Marina Vatmakhter
April 08, 2022
Technology
0
230
Demystifying SwiftUI Previews
Understand how SwiftUI previews work, why they pause, and how to fix it.
Marina Vatmakhter
April 08, 2022
Tweet
Share
More Decks by Marina Vatmakhter
See All by Marina Vatmakhter
Bug-Free by Design: Crafting Swift Code That Doesn't Sting
hybridcattt
0
150
Detail-oriented UI with Layout Margins @NSSpain 2019
hybridcattt
2
600
Collection Views: Diffable Data Sources and Compositional Layout | Workshop @SwiftIsland 2019
hybridcattt
0
290
Detail-oriented UI with Layout Margins
hybridcattt
1
380
Flow Coordinators IRL
hybridcattt
0
200
SaaS- SDK as a service
hybridcattt
0
190
Other Decks in Technology
See All in Technology
Phase07_実務適用
overflowinc
0
510
A Casual Introduction to RISC-V
omasanori
0
510
DDD×仕様駆動で回す高品質開発のプロセス設計
littlehands
1
1.2k
Phase05_ClaudeCode入門
overflowinc
0
580
SLI/SLO 導入で 避けるべきこと3選
yagikota
0
140
形式手法特論:SMT ソルバで解く認可ポリシの静的解析 #kernelvm / Kernel VM Study Tsukuba No3
ytaka23
1
710
スピンアウト講座03_CLAUDE-MDとSKILL-MD
overflowinc
0
350
AIエージェント×GitHubで実現するQAナレッジの資産化と業務活用 / QA Knowledge as Assets with AI Agents & GitHub
tknw_hitsuji
0
130
Laravelで学ぶOAuthとOpenID Connectの基礎と実装
kyoshidaxx
4
1.5k
20年以上続く PHP 大規模プロダクトを Kubernetes へ ── クラウド基盤刷新プロジェクトの4年間
oogfranz
PRO
0
140
【社内勉強会】新年度からコーディングエージェントを使いこなす - 構造と制約で引き出すClaude Codeの実践知
nwiizo
8
4.8k
Copilot 宇宙へ 〜生成AIで「専門データの壁」を壊す方法〜
nakasho
0
130
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
77
5.3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
230
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
75
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
220
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
690
Music & Morning Musume
bryan
47
7.1k
Fireside Chat
paigeccino
42
3.8k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
830
Scaling GitHub
holman
464
140k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
400
Transcript
Demystifying SwiftUI previews Marina Gornostaeva | @hybridcattt
Agenda ! Other use-cases " Preview lifecycle # The build
process $ How live reloading works ⏸ Reduce previews pausing
! Other use-cases
! Other use-cases
" Lifecycle of a SwiftUI preview • Build once •
Live reload on changes • Pause if change is unsupported by live reloading • Repeat
# Build process • For DEBUG • Detect by ENABLE_PREVIEWS
build setting • Use ProcessInfo in runtime
$ Dynamic replacement • Swift feature called @_dynamicReplacement • Pitched
in 2018 • Supports changes in implementation of a function, computed variable, initializer or subscript struct MyStruct { dynamic func x() { print("x") } } extension MyStruct { @_dynamicReplacement(for: x()) func y() { print("y - replaced dynamically") } }
$ Limitations of live reloading • It’s applied to everything
in the current ile • Supported: changes to bodies of functions, properties, initializers • Not supported: • Editing comments • Signature changes • Adding/removing types, functions, properties • Initial value changes • Changes in other iles
⏸ Improving live reloading • Use computed vars • Check
build scripts • Auto-resume previews
Thanks & @hybridcattt https://hybridcattt.com/blog/ ixing-swiftui-previews