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
260
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
420
Flow Coordinators IRL
hybridcattt
0
220
SaaS- SDK as a service
hybridcattt
0
210
Other Decks in Technology
See All in Technology
SmartHR Engineering Team Deck
smarthr
1
3k
AIに持続⼒を与える 判断の⻑期記憶設計
eiei114
1
350
FORENSIA: ローカルLLMフォレンジックハーネス
sumeshi
2
430
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
9.3k
AIのためのEthernet技術動向 (SerDes)
markunet
1
240
도구에서 동료까지: 10년차 AI 스타트업의 AI 적응기
inureyes
PRO
1
270
【CEDEC2026】Creative Approaches to Localizing the Dialects and Unique Speech of Umamusume: Pretty Derby Characters in English
cygames
PRO
3
26k
【書籍出版記念】 10周回って、エージェント開発は RAGがすべてだった。〜RAGの歴史と開発現場で見えた実践知〜
akiratameto
2
360
老害フォレンジッカーはAI羊の夢を見るか?
tadmaddad
0
350
Apache Icebergインフラストラクチャ:ストレージ・カタログ・エンジンの選択肢とClouderaプラットフォームでの実装
tsugiyama
0
120
AIで変わるエンジニアの働き方(仮)
naoinaoi
0
190
システム思考で問題に対処する
yussak
0
360
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
550
Embracing the Ebb and Flow
colly
88
5.1k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
260
The agentic SEO stack - context over prompts
schlessera
0
870
Bash Introduction
62gerente
615
220k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
550
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
170
Crafting Experiences
bethany
1
260
So, you think you're a good person
axbom
PRO
2
2.1k
Building AI with AI
inesmontani
PRO
1
1.1k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
250
AI: The stuff that nobody shows you
jnunemaker
PRO
9
930
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