The Xcode 12 beta includes Swift 5.3 but drops support for iOS 8.x. This means that Swift packages that support iOS 8 will cause a warning:
The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99.
It's not possible to remove this warning within a project that depends on a Swift package with a deployment target of iOS 8, but it is possible to fix this in the dependency without removing support for iOS 8 for older versions of Swift. There are multiple way this can be accomplished.
In this example a new
Package@swift-5.3.swift file can be added with a small change:
-// swift-tools-version:5.2 +// swift-tools-version:5.3
platforms: [ - .iOS(.v8), + .iOS(.v9), ],
This change is arguably not a breaking change so does not require a new major version of the package but it still fixes the warning. It could be argued that someone may use Xcode 12 with an older version of Swift or an older version of Xcode with a newer version of Swift, but the App Store would not accept an app built a Swift toolchain that did not come with the download of Xcode.
#if compiler Compilation Condition
A second option is to use
#if compiler to update the supported platforms. This has the advantage of not requiring multiple package files, but can also lead to confusing if the package file is large and the condition is easy to miss.
This can be added after the
let package = declaration:
#if compiler(>= 5.3) package.platforms = [.iOS(.v9)] // Ensure to add any other platforms you support here too! #endif
#if compiler is used rather than
#if swift to allow for newer compilers that are compiling code using an older Swift language version. This change was pointed out to me when I was making this change as part of a PR on the CombineX project to fix the warning in Xcode 12.