Video yükleniyor...
Video Yüklenemedi
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

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

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).

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

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

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.

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

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

I’m on macOS Sequoia 15.7.2 running Xcode 26.2.

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

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

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

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

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.
