SwiftUI previews not loading

Hello,

I am a UIKit developer and I would like to try out SwiftUI.

Unfortunately, my previews don't load.

My situation is like the one described in this blog post: https://forums.developer.apple.com/forums/thread/704036.

Unfortunately I can't update Xcode like that developer did.

What I've tried: quitting and restarting Xcode, restarting my computer, resetting the simulator, deleting the derived data folder, creating new projects without storage options, test bundles or source control, editing the content view of the initial Hello World file.

To be clear, I've just started learning about SwiftUI, just yesterday evening, and the previews have never loaded.

Is the problem solvable?

If so, how?

What version of Xcode? Does your code have errors?

Thank you for responding despite my vagueness.

Apple MacBook Air M1, 8 GB, MacOS Sonoma 14.2.1, Xcode 15.2--I forgot to paste it from the TSI message.

After a few hours, I got the "Cannot preview in this file" error.

I’ve noticed that my derived data folder has a different location according to Xcode and Finder.

According to Xcode, the root path is /Users/filippo.

But, according to Finder, it's /Users/Filippo.

I changed my username a year ago.

If you think this issue could be related to my problem, please tell me how to solve it.

Disabling Siri end enabling it back again in macos settings helped me.

Looks like the iOS simulator (that is used to render the preview) was making a lot of XPC requests to Siri. I opened the Console.app and noticed that the coreaudiod has spammed with a lot of messages. So switching the Siri back and forth made SwiftUI preview immediately finish rendering

SwiftUI previews not loading
 
 
Q