How to get Previews working again in a SwiftUI project

In case this is useful to anyone, I fixed the issue of "previews not working" by renaming one of my CoreData model properties from "created" (Double) to "createdTimestamp" (Double).


For me I have had good luck addressing this problem using this command:

xcrun simctl --set previews delete all

Appears to do the same thing as an "rm" over the previews simulator, but gets all of the devices and seems to make sure the state of the simulator service is set right afterward.


I think I have solved this. I had made what probably sounds like a stupid mistake. The project uses CoreData and I had given one of the Entities the same name as the project. Whilst that might sound crazy, the project would build and run (simulator or device) without a problem. It was just the preview that was getting confused. I have renamed the Entity and at least some of the Views can be previewed, including the TestView mentioned above. There are still a couple of Views not previewing correctly, but I think that is due to another issue.