// swift-tools-version:5.0
import PackageDescription

var platforms: [SupportedPlatform] {
    #if compiler(<5.3)
        return [
            .macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v2)
        ]
    #else
        // Xcode 12 (which ships with Swift 5.3) drops support for iOS 8
        return [
            .macOS(.v10_10), .iOS(.v9), .tvOS(.v9), .watchOS(.v2)
        ]
    #endif
}

let package = Package(
    name: "APIKit",
    platforms: platforms,
    products: [
        .library(name: "APIKit", targets: ["APIKit"]),
    ],
    dependencies: [],
    targets: [
        .target(
            name: "APIKit", 
            dependencies: [],
            exclude: ["BodyParameters/AbstractInputStream.m"]
        ),
         .testTarget(
            name: "APIKitTests",
            dependencies: ["APIKit"]
        ),
    ],
    swiftLanguageVersions: [.v5]
)

// swift-tools-version:5.0
import PackageDescription

let package = Package(
    name: "APIKit",
    platforms: [
        .macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v2)
    ],
    products: [
        .library(name: "APIKit", targets: ["APIKit"]),
    ],
    dependencies: [],
    targets: [
        .target(
            name: "APIKit", 
            dependencies: [],
            exclude: ["BodyParameters/AbstractInputStream.m"]
        ),
         .testTarget(
            name: "APIKitTests",
            dependencies: ["APIKit"]
        ),
    ],
    swiftLanguageVersions: [.v5]
)

--- 
+++ 
@@ -1,11 +1,22 @@
 // swift-tools-version:5.0
 import PackageDescription
 
+var platforms: [SupportedPlatform] {
+    #if compiler(<5.3)
+        return [
+            .macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v2)
+        ]
+    #else
+        // Xcode 12 (which ships with Swift 5.3) drops support for iOS 8
+        return [
+            .macOS(.v10_10), .iOS(.v9), .tvOS(.v9), .watchOS(.v2)
+        ]
+    #endif
+}
+
 let package = Package(
     name: "APIKit",
-    platforms: [
-        .macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v2)
-    ],
+    platforms: platforms,
     products: [
         .library(name: "APIKit", targets: ["APIKit"]),
     ],
Change iOS deployment target for Xcode 12

This removes the warning about iOS 8 no longer being supported in Xcode 12 while maintaining support for older versions of Xcode. Technically checking the compiler version isn’t an exact 1:1 for checking for Xcode version, but in practice should work in all scenarios.
