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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
AIはハッカーを減らすのか、増やすのか?──現役ホワイトハッカーから見るAI時代のリアル【MEGU-Meet】
cscengineer
PRO
0
240
AIでAIをテストする - 音声AIエージェントの品質保証戦略
morix1500
1
150
AI와 협업하는 조직으로의 여정
arawn
0
560
Keeping Ruby Running on Cygwin
fd0
0
190
はじめての MagicPod生成AI機能 機能紹介から活用方法まで
magicpod
0
120
エージェントスキルを作って自分のインプットに役立てよう
tsubakimoto_s
0
480
Agents CLI と Gemini Enterprise Agent Platform で マルチエージェント開発が楽しくなる!
kaz1437
0
190
20260428_Product Management Summit_tadokoroyoshiro
tadokoro_yoshiro
15
16k
ファインディの事業拡大を支える 拡張可能なデータ基盤へのリアーキテクチャ
hiracky16
0
480
Cortex Codeのコスト見積ヒントご紹介
yokatsuki
0
130
FessのAI検索モード:検索システムとLLMへの取り組み
marevol
0
130
「責任あるAIエージェント」こそ自社で開発しよう!
minorun365
10
2.6k
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
450
4 Signs Your Business is Dying
shpigford
187
22k
Rails Girls Zürich Keynote
gr2m
96
14k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.4k
Prompt Engineering for Job Search
mfonobong
0
280
Agile that works and the tools we love
rasmusluckow
331
21k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
160
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
500
Utilizing Notion as your number one productivity tool
mfonobong
4
290
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
170
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
210
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