SwiftUI Preview not working in a large project

In a large project that I am working on, SwiftUI Previews do not work. (Xcode 13.4, iOS 15)

You can make the simplest of SwiftUI files - like:

import SwiftUI

struct TestView: View {
    var body: some View {
        Text("Hello, World!")
    }
}

struct TestView_Previews: PreviewProvider {
    static var previews: some View {
        TestView()
    }
}

And the Canvas will only show:

"Automatic preview updating pauses when the previewed file is edited in a way that causes the containing module to be rebuilt."

I've tried Resume, Refresh Canvas, Deleting Derived Data - but we just can't seem to get it to work.

Any ideas? Thanks in advance, Scott

I gave up on SwiftUI previews as soon as I migrated my test project over to the main project for that very reason. I don't think it's my computer either because I bought a pretty high end MacBook Pro and they're still sluggish. I guess for prototyping you could always build them in a small project and port over, but that seems needless.

We've had to do that as well - make a temp/test project, do your code/layout/previews there - then copy/paste the code to the main project.

Few days before i have seen very strange behavior in frameworks. This is due to changes made to the simulator to support Apple silicon. My temporary workaround is to add "arm64" to the build settings "excluded architectures" for the app/extension target when building for the simulator (which preview seems to be trying to do) and add "active The only thing to do is to add "Build only for valid architectures" to the "No" setting for all schemes.

Regards, J Wick

Hey I am facing same issue are you able to resolve it ?

SwiftUI Preview not working in a large project
 
 
Q