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
0
180
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
110
Detail-oriented UI with Layout Margins @NSSpain 2019
hybridcattt
2
500
Collection Views: Diffable Data Sources and Compositional Layout | Workshop @SwiftIsland 2019
hybridcattt
0
230
Detail-oriented UI with Layout Margins
hybridcattt
1
300
Flow Coordinators IRL
hybridcattt
0
140
SaaS- SDK as a service
hybridcattt
0
130
Other Decks in Technology
See All in Technology
職種に名前が付く、ということ/The fact that a job title has a name
bitkey
1
220
初めてのPostgreSQLメジャーバージョンアップ
kkato1
0
320
みんなで育てるNewsPicksのSLO
troter
4
1.1k
Agile TPIを活用した品質改善事例
tomasagi
0
160
AIエージェントキャッチアップと論文リサーチ
os1ma
6
990
Oracle Cloud Infrastructure:2025年3月度サービス・アップデート
oracle4engineer
PRO
0
320
fukuoka.ts #3 社内でESLintの共通設定を配りたい2025年春版
pirosikick
1
280
「エンジニアマネージャー」の役割を担っている / 担ってみたい方へのキャリアパスガイド
coconala_engineer
1
220
Redefine_Possible
upsider_tech
0
180
EM初心者として半年間マネジャーをやってみて分かったこと
sansantech
PRO
0
200
技術的負債を正しく理解し、正しく付き合う #phperkaigi / PHPerKaigi 2025
shogogg
7
1.7k
AIエージェント完全に理解した
segavvy
4
230
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
42
7.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Building Your Own Lightsaber
phodgson
104
6.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Done Done
chrislema
183
16k
Unsuck your backbone
ammeep
669
57k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
Mobile First: as difficult as doing things right
swwweet
223
9.5k
How STYLIGHT went responsive
nonsquared
99
5.4k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.9k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
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