Skip to content

Commit

Permalink
Merge pull request #14 from MFB-Technologies-Inc/feature/strict-concu…
Browse files Browse the repository at this point in the history
…rrency-checking

Feature/strict concurrency checking
  • Loading branch information
r-jarvis authored Oct 5, 2023
2 parents 7dce9e8 + 8171c89 commit 16abd6d
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
73 changes: 73 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -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"
),
]
}
2 changes: 1 addition & 1 deletion Sources/NetworkService/NetworkService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 16abd6d

Please sign in to comment.