Skip to content

Conversation

rconnell9
Copy link
Contributor

@rconnell9 rconnell9 commented Oct 20, 2025

Explicitly set the Swift language mode on package init

Motivation:

When a package is created using swift package init no language mode is specified and defaults to using Swift 5.

New packages should be written in Swift 6, so explicitly set the language mode to 6 on package init.

Modifications:

Include a language mode on package init

Result:

New packages created using swift package init will include the following by default: swiftLanguageModes: [.v6]

let package = Package(
    name: "tmp",
    products: [
        // Products define the executables and libraries a package produces, making them visible to other packages.
        .library(
            name: "tmp",
            targets: ["tmp"]
        ),
    ],
    targets: [
        // Targets are the basic building blocks of a package, defining a module or a test suite.
        // Targets can depend on other targets in this package and products from dependencies.
        .target(
            name: "tmp"
        ),
        .testTarget(
            name: "tmpTests",
            dependencies: ["tmp"]
        ),
    ],
    swiftLanguageModes: [.v6]
)

@rconnell9
Copy link
Contributor Author

@swift-ci test

@rconnell9
Copy link
Contributor Author

@swift-ci test linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants