Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

One tip to speed up your SwiftUI previews 🤩 I wanted to centralize constants like opacity, spacing, or sizes used by my View to speed up prototyping. Stored properties: slow 🐌 as Xcode recompiles the file every time I tweak a value. Computed properties: instant updates 🏎️

52,457 görüntüleme • 9 ay önce •via X (Twitter)

13 Yorum

Duy Luong profil fotoğrafı
Duy Luong9 ay önce

That's definitely weird as I thought it should do the opposite way 🤔

Axel Le Pennec profil fotoğrafı
Axel Le Pennec9 ay önce

I thought too! Let me know if you observe the same on your side. Tested on 2 different projects in Xcode Version 26.2 (17C52).

Dan Monaghan profil fotoğrafı
Dan Monaghan9 ay önce

Is this not a regression, then this is the kind of bug that has consumed human lifetimes in delay.

Axel Le Pennec profil fotoğrafı
Axel Le Pennec9 ay önce

I filed a feedback following a discussion with someone working at Apple.

Dan Monaghan profil fotoğrafı
Dan Monaghan9 ay önce

Any idea if it’s pre 26? It just makes SwiftUI preview no fun given it’s so slow, even InjectionIII seems quicker and I’ve wondered if it’s a better choice.

Axel Le Pennec profil fotoğrafı
Axel Le Pennec9 ay önce

Pre 26, what do you mean? I’ve never used injection so I can’t compare.

Dan Monaghan profil fotoğrafı
Dan Monaghan9 ay önce

macOS Tahoe, like is it a regression in latest macOS or has this always been the case prior?

Axel Le Pennec profil fotoğrafı
Axel Le Pennec9 ay önce

I’m on macOS Sequoia 15.7.2 running Xcode 26.2.

Arseny profil fotoğrafı
Arseny9 ay önce

That is actually not even SwiftUI specific. If you use previews with UIKit it works the same way, computed properties reflect changes way quicker

Axel Le Pennec profil fotoğrafı
Axel Le Pennec9 ay önce

Good to know! I suspected the same but I don’t use Previews with UIKit so I haven’t checked. Thanks for sharing!

Axel Le Pennec profil fotoğrafı
Axel Le Pennec9 ay önce

Is this something "expected" @squeakytoy? Or should I file a feedback to improve Xcode?

Josh Woods profil fotoğrafı
Josh Woods9 ay önce

if there are preview wins, would there also be wins in rendering/update performance in prod, as well? 🤔🤔🤔🤔

Axel Le Pennec profil fotoğrafı
Axel Le Pennec9 ay önce

The reason Previews are slow when using store property vs comp is because Xcode recompiles the app (as you can see in the video where every time I update a stored property the file is recompiled). If i'm not wrong, this should not have any impact on a compiled app in production.

Benzer Videolar