From 83a5029c31021083f707f9b22f890fb96cbebf5a Mon Sep 17 00:00:00 2001 From: Andrew Roan Date: Thu, 5 Oct 2023 01:02:04 -0500 Subject: [PATCH 1/3] Enable strict concurrency checking for swift 5.8+ feature/strict-concurrency-checking --- Package@swift-5.8.swift | 73 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Package@swift-5.8.swift diff --git a/Package@swift-5.8.swift b/Package@swift-5.8.swift new file mode 100644 index 0000000..d154aac --- /dev/null +++ b/Package@swift-5.8.swift @@ -0,0 +1,73 @@ +// swift-tools-version:5.8 + +import PackageDescription + +let package = Package( + name: "NetworkService", + platforms: [.iOS(.v13), .macOS(.v10_15), .tvOS(.v13), .watchOS(.v6)], + products: Product.products, + dependencies: Package.Dependency.dependencies, + targets: Target.targets +) + +extension Product { + static let products: [Product] = [ + .library( + name: "NetworkService", + targets: ["NetworkService"] + ), + .library( + name: "NetworkServiceTestHelper", + targets: ["NetworkServiceTestHelper"] + ), + ] +} + +extension Target { + static let targets: [Target] = [ + .target(name: "NetworkService"), + .testTarget( + name: "NetworkServiceTests", + dependencies: [ + "NetworkService", + .product(name: "OHHTTPStubs", package: "OHHTTPStubs"), + .product(name: "OHHTTPStubsSwift", package: "OHHTTPStubs"), + ] + ), + .target( + name: "NetworkServiceTestHelper", + dependencies: [ + "NetworkService", + .product(name: "CombineSchedulers", package: "combine-schedulers"), + ] + ), + .testTarget( + name: "NetworkServiceTestHelperTests", + dependencies: [ + "NetworkServiceTestHelper", + .product(name: "CombineSchedulers", package: "combine-schedulers"), + ] + ), + ] +} + +package.targets.strictConcurrency() + +extension Array where Element == Target { + func strictConcurrency() { + forEach { target in + target.swiftSettings = (target.swiftSettings ?? []) + + [.enableUpcomingFeature("StrictConcurrency")] + } + } +} + +extension Package.Dependency { + static let dependencies: [Package.Dependency] = [ + .package(url: "https://github.com/AliSoftware/OHHTTPStubs.git", from: "9.1.0"), + .package( + url: "https://github.com/pointfreeco/combine-schedulers.git", + from: "1.0.0" + ), + ] +} From 4fbc6a76f02991434b5b31f792b5e47470cf0a87 Mon Sep 17 00:00:00 2001 From: Andrew Roan Date: Thu, 5 Oct 2023 01:02:19 -0500 Subject: [PATCH 2/3] Conform NetworkService to Sendable feature/strict-concurrency-checking --- Sources/NetworkService/NetworkService.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/NetworkService/NetworkService.swift b/Sources/NetworkService/NetworkService.swift index 7f6c713..21e5150 100644 --- a/Sources/NetworkService/NetworkService.swift +++ b/Sources/NetworkService/NetworkService.swift @@ -10,7 +10,7 @@ import Combine import Foundation /// Provides methods for making network requests and processing the resulting responses -public final class NetworkService { +public final class NetworkService: Sendable { /// `NetworkService`'s error domain public enum Failure: Error, Hashable, Sendable { case urlResponse(URLResponse) From 8171c895e3ce5663c072ecf785b6e7f72787ee1f Mon Sep 17 00:00:00 2001 From: Andrew Roan Date: Thu, 5 Oct 2023 01:02:43 -0500 Subject: [PATCH 3/3] Add Xcode 15/Swift 5.9 test strategy to workflow feature/strict-concurrency-checking --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5384306..e749840 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,8 @@ jobs: xcode: 14.2 # Swift 5.7 - os: macos-13 xcode: 14.3 # Swift 5.8 + - os: macos-13 + xcode: '15.0' # Swift 5.9 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3