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.
#if SWIFT_PACKAGE #import "../Defines.h" #else #import "Defines.h" #endif // SWIFT_PACKAGE
I tried adding the flag to Package.swift but this did not solve the issue.
cSettings: [ .define("SWIFT_PACKAGE") ]
After some debugging I found this in Xcode 11.4 (11E146) where the SWIFT_PACKAGE flag is defined and not defined at the same time.
When I try to build the project using swift build or using the Xcode project everything work fine.