SwiftUI Preview "Timed out waiting for a thunk to build"

I absolutely cannot get my project to generate a SwiftUI preview, even for the simple "hello world" default. It builds successfully, spins for thirty seconds, then throws an error: TimeoutError: Timed out waiting for a thunk to build after 30.0 seconds.

I've tried the usual stuff: Cleaning the build folder, erasing the derived data folder, rebooting, only running Xcode (in case it's a memory issue). No change. I don't see anything obvious in the diagnostic, but happy to post if someone wants to see it.

It only seems to happen with this project. A different one (a SwiftUI app I wrote months ago) continues to work fine. This project is older, however, and has no existing SwiftUI code. It happens in both Xcode 11.5 and 12.0b2.

My machine is a 2016 13" MacBook Pro (four-port Touch Bar) with 16GB RAM and a dual-core i5.

Any ideas on what else to try? This a major impedance for my iOS 14 updates...

Accepted Reply

What's the iOS version attached to your build target? If you boost to 14, does this go away?

A very common reason I've seen this happen in older projects is that SwiftUI Previewing just does not seem to support code tucked behind older iOS versions and #if flags.

Replies

What's the iOS version attached to your build target? If you boost to 14, does this go away?

A very common reason I've seen this happen in older projects is that SwiftUI Previewing just does not seem to support code tucked behind older iOS versions and #if flags.
It was 12.0, but I've tried 13.0 and 13.5 (and 14.0 in the Xcode beta) to no avail.

Also, I accidentally marked that as the answer, but can't seem to undo it?

Also, I accidentally marked that as the answer, but can't seem to undo it? 

According to the guide of the forums, you cannot unmark SOLVED.

Questions and Replies

...
Only the author of a question can mark the question as solved, and it can’t be unmarked.
Better start a new thread including all the up-to-date info. Once marked as SOLVED, the thread would not get enough attention.
Sorry! I also could not see what was happening in this thread, since there is no notification system or even an ability to see what conversations a person has participated in, haha.

If you change your target, then remove the @if flags around it, usually that will help. At that point, clear your build cache and derived data and reopen the project. If you still can't get it to happen, you may be stuck for now by nature of some piece of older code in your project that is simply too complex to check with the way the preview system works.

The good news is that if you are using the Xcode beta, incremental builds and running is so fast now that you can probably continue to get work done without those previews and still have an excellent experience. In fact, even when I have access, I'll frequently hide the preview window.

Ultimately this problem just points out how detrimental to progress and usability it was to omit the need of some statement terminator, such as a semi-colon. Now we have a completely broken and incapable recursive decent parser that just cannot arrive at a usable conclusion on the appropriate problem line of code. So we can to waste 100s of hours of development time, each, trying to work around this nonsense of a development environment. It is literally 3 years later/after this ticket was first posted and this is still happening.

this is donkey shit