Unfortunately, SwiftPM does not inherit Xcode's build settings at all from a containing project. And there is no way to specify any Xcode build setting in a package manifest. Specifying an executable target with SwiftUI in a package is an interesting case. If I were in your shoes, I'd just pull everything out into another module target in the package and have the executable depend on it. Previewing in that module will work just fine. All the executable needs is the @main entry point. It doesn't need the views or previews to be in that target.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: