When you’re writing a quick tool, perhaps to visualize something, or to get user feedback, an Xcode project can feel like overkill. It’s often very useful to have a single file that you just run with swift myfile.swift from Terminal. Likewise, when you’re inside a Swift Package Manager project, you might not want to create an additional Xcode project when you’re just testing things out.
Source: SwiftUI: Running a Mac App Without an Xcode Project · objc.io