Swift build fails/ignores platform description (macOS/XCode beta 6)

I have a package which should support iOS 13 only

let package = Package(
    name: "ACME",
    platforms: [
        .iOS(.v13)
    ],
   ....
)

This used to build fine, but with the latest macOS/XCode beta 6 update, it seems like the macOS platform is implicitly targeted as well, i.e. the build fails with errors like these:

error:** **'Color' is only available in macOS 10.15 or newer

What helped is adding .macOS(.v10_15) to the platforms, but then it doesn't build on our production machines with macOS 10.14.

let package = Package(
    name: "ACME",
    platforms: [
         .macOS(.v10_15), .iOS(.v13)
    ],
   ....
)

Update

The answer is: Building/Testing for iOS is not yet supported by the SPM.

Swift Package Manager includes a build system that can build for macOS and Linux. Xcode 11 integrates with libSwiftPM to provide support for iOS, watchOS, and tvOS platforms.

2 Likes

The platforms feature is currently only about customising deployment targets, there is no way to restrict the platforms of a package.

2 Likes