I has this problem with #Preview
s within newly created Swift Package
.
When I added this package to main app via Frameworks, Libraries and Embedded Content
in General
Tab, the problem was solved.
As error says, it does not need to be main target, any target in current scheme will do.