In following a fairly short SwiftUI tutorial, I have gotten the same error in Xcode a couple of times over the last week when just trying to preview. The top bar has a number 2 with a spinning blue animation around it and next to that says "Preparing iPhone Simulator for Previews":
The errors are: Command CompileSwiftSources failed with a nonzero exit code
Swift Compilor Error: Expected identifier in function declaration
Aside from trying to understand what is happening in my instance, a general question is when Xcode has been hung on "Preparing iPhone Simulator for Previews" for at least 20 minutes and the code is very basic, do I just restart Xcode? Should I restart my computer as well? Do a command K clean?
Running: Xcode 13 beta 2 (13A5155e) on MacBook Pro 2019