SwiftUI Preview times out on big existing project

We've added new features to an existing swift/storyboard project using SwiftUI. However, previews don't work for these new views because they timeout.

When I click preview for a SwiftUI view, I can see the compiler running, but after about a minute it says "Automatic preview updating paused" and the 'resume' button appears. It appears the project is trying to compile a bunch of stuff before it will display the preview. If I hit 'resume', whether I wait for the compile activity to finish or not, it starts compiling everything all over again and the cycle repeats.

What can I do to either

  1. enable previews to not time out, or
  2. Speed up our build process so previews don't time out?

Our builds take about a 1 minute with no source code changes, to over 3 minutes from a 'clean' state.

Having the same issue, I think. Not really sure what I can do about it. Did you happen to figure something out?

I've had problems where the project had types that matched SwiftUI types and the preview would never really finish loading.

Things like "Coordinator" "View" or "Button", despite being in the namespace of your project and not the swiftUI namespace, seem to confuse the preview compiler.

SwiftUI Preview times out on big existing project
 
 
Q