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
Marina Vatmakhter
April 08, 2022
Technology
240
0
Share
Demystifying SwiftUI Previews
Understand how SwiftUI previews work, why they pause, and how to fix it.
Marina Vatmakhter
April 08, 2022
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
610
Collection Views: Diffable Data Sources and Compositional Layout | Workshop @SwiftIsland 2019
hybridcattt
0
290
Detail-oriented UI with Layout Margins
hybridcattt
1
390
Flow Coordinators IRL
hybridcattt
0
200
SaaS- SDK as a service
hybridcattt
0
190
Other Decks in Technology
See All in Technology
建設的な現実逃避のしかた / How to practice constructive escapism
pauli
4
310
プロジェクトマネジメントは AIでどう変わるか?
mkg5383
0
200
3つのボトルネックを解消し、リリースエンジニアリングを再定義した話
nealle
0
370
Digitization部 紹介資料
sansan33
PRO
1
7.2k
DevOpsDays2026 Tokyo Cross-border practices to connect "safety" and "DX" in healthcare
hokkai7go
0
120
Discordでリモートポケカしてたら、なぜかDOを25分間動かせるようになった話
umireon
0
120
さくらのクラウドでつくるCloudNative Daysのオブザーバビリティ基盤
b1gb4by
0
150
NgRx SignalStore: The Power of Extensibility
rainerhahnekamp
0
190
終盤で崩壊させないAI駆動開発
j5ik2o
0
470
Databricksで構築するログ検索基盤とアーキテクチャ設計
cscengineer
0
150
Introduction to Bill One Development Engineer
sansan33
PRO
0
400
AI時代に新卒採用、はじめました/junior-engineer-never-die
dmnlk
0
240
Featured
See All Featured
A designer walks into a library…
pauljervisheath
211
24k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
310
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
The Curious Case for Waylosing
cassininazir
0
290
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
330
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
260
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
The browser strikes back
jonoalderson
0
930
Everyday Curiosity
cassininazir
0
190
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
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