fwcd / swift-utils

General-purpose utility library for Swift
https://fwcd.github.io/swift-utils/documentation/utils
MIT License
12 stars 0 forks source link

Make `swift-utils` compile under the Swift 6 language mode #8

Closed fwcd closed 1 month ago

fwcd commented 1 month ago

This fixes all concurrency-related issues and makes the library compile under the Swift 6 language mode. Additionally:

To fully enable it, we'll have to enable the language mode too, though, which also bumps the required Swift version to 6.0:

diff --git a/Package.swift b/Package.swift
index e8db2a8..cb0139a 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,4 +1,4 @@
-// swift-tools-version:5.7
+// swift-tools-version:6.0
 // The swift-tools-version declares the minimum version of Swift required to build this package.

 import PackageDescription
@@ -29,6 +29,9 @@
                 .product(name: "Logging", package: "swift-log"),
                 .product(name: "SwiftSoup", package: "SwiftSoup"),
                 .product(name: "XMLCoder", package: "XMLCoder"),
+            ],
+            swiftSettings: [
+                .swiftLanguageMode(.v6)
             ]
         ),
         .testTarget(

Hence why we defer this to a future PR[^1].

[^1]: Side note: Unfortunately building with swift build -Xswiftc -swift-version -Xswiftc 6 as suggested in the migration guide is not sufficient as this will also try building dependencies like swift-log in Swift 6 language mode.