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
250
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
160
Detail-oriented UI with Layout Margins @NSSpain 2019
hybridcattt
2
620
Collection Views: Diffable Data Sources and Compositional Layout | Workshop @SwiftIsland 2019
hybridcattt
0
300
Detail-oriented UI with Layout Margins
hybridcattt
1
410
Flow Coordinators IRL
hybridcattt
0
220
SaaS- SDK as a service
hybridcattt
0
210
Other Decks in Technology
See All in Technology
AIQAのナレッジ構築について
qatonchan
1
130
エンタープライズデータへ安全につなぐ Production-ready なエージェント設計 ― AI × MCP リファレンスアーキテクチャ ― #AIDevDay
cdataj
1
340
ウォーターフォール開発案件のPMとしてAI活用を模索している話
hatahata021
2
220
データと地図で読む 大井町の「かわるもの、かわらないもの」
yoshiyama_hana
0
760
データ組織の転換期 一足飛びしない段階的戦略
leveragestech
PRO
0
120
GMOフィナンシャルゲートが挑む、「止まらない」決済インフラ構築の裏側【SORACOM Discovery 2026】
soracom
PRO
0
110
StepFunctionsとGraphRAGを活用した暗黙知活用のためのRAG基盤
yakumo
0
190
LangfuseによるLLMOps基盤の構築と活用事例
zozotech
PRO
1
190
CloudWatchから始めるAWS監視
butadora
0
300
Claude Code並行開発環境の ムダ‧ムラ‧ムリを見直した話
muranakaaa
0
340
PLaMo 3.0 Primeの構造化出力サポート
pfn
PRO
0
130
歴史から理解するクラウドインフラのしくみ
kizawa2020
0
190
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Making Projects Easy
brettharned
120
6.7k
Git: the NoSQL Database
bkeepers
PRO
432
67k
A Modern Web Designer's Workflow
chriscoyier
698
190k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
57k
Google's AI Overviews - The New Search
badams
0
1.1k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
240
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.5k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
A designer walks into a library…
pauljervisheath
211
24k
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