Swift5.4 `swift package init --type executable ` still 5.3

➜  SwiftFiveFour swift --version
Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
Target: x86_64-apple-darwin20.4.0
➜  SwiftFiveFour swift package --version
Swift Package Manager - Swift 5.4.0
➜  SwiftFiveFour 


// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "SwiftFiveFour",
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
            name: "SwiftFiveFour",
            dependencies: []),
            name: "SwiftFiveFourTests",
            dependencies: ["SwiftFiveFour"]),

The reason is in the second line of the result. The swift-tools-version limits which version of swift can build the package. Package creators will most likely not want to limit the consumers of their packages to swift 5.4 only, (excluding users of swift 5.3).

Terms of Service

Privacy Policy

Cookie Policy