I have a library written in Objective-C that I'm trying to add a Package.swift to it.
When I add this library as a Swift package to other projects (written in Swift or Objective-C) using Xcode I get an error because the SWIFT_PACKAGE flag is not defined, this flag is used to conditionally import some headers.
I've seen that SWIFT_PACKAGE is not enabled when Xcode constructs modules from public headers. I've restructured headers to avoid the need for differentiating between SPM and CocoaPods clients. Details here.
Good point, I think that requires some thinking on how it should work in that context. Since the client of a package is not necessarily a package, it probably should not get the SWIFT_PACKAGE define. We could impart the setting on clients, but there isn't really a way to restrict it to individual modules/headers, so it would affect any headers that are imported by the clients, also ones from non-packages.