Skip to content

Commit 5e59d30

Browse files
committed
upd SwiftFormat rules and github actions and Threading with new AtomicValue
1 parent 0346e7b commit 5e59d30

File tree

59 files changed

+419
-262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+419
-262
lines changed

.github/workflows/swift_macos.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- "main"
7+
- $default-branch
78
paths:
89
- ".github/workflows/**"
910
- "Package.swift"
@@ -30,7 +31,11 @@ jobs:
3031
fail-fast: false
3132
matrix:
3233
include:
33-
- xcode: "Xcode_16"
34+
- xcode: "Xcode_16.3"
35+
runsOn: macOS-15
36+
swift: "6.1"
37+
outputFilter: xcbeautify --renderer github-actions
38+
- xcode: "Xcode_16.0"
3439
runsOn: macOS-15
3540
swift: "6.0"
3641
outputFilter: xcbeautify --renderer github-actions
@@ -43,7 +48,7 @@ jobs:
4348
swift: "5.9"
4449
outputFilter: xcbeautify --renderer github-actions
4550
steps:
46-
- uses: NeedleInAJayStack/setup-swift@feat/swift-6 # swift-actions/setup-swift@main
51+
- uses: swift-actions/setup-swift@v2
4752
with:
4853
swift-version: ${{ matrix.swift }}
4954
- uses: actions/checkout@v4

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ let package = Package(
1616
.library(name: "SmartNetwork", targets: ["SmartNetwork"])
1717
],
1818
dependencies: [
19-
.package(url: "https://github.com/NikSativa/SpryKit.git", .upToNextMinor(from: "3.0.2")),
20-
.package(url: "https://github.com/NikSativa/Threading.git", .upToNextMinor(from: "2.1.1"))
19+
.package(url: "https://github.com/NikSativa/SpryKit.git", from: "3.0.4"),
20+
.package(url: "https://github.com/NikSativa/Threading.git", from: "2.2.0")
2121
],
2222
targets: [
2323
.target(name: "SmartNetwork",

Package@swift-5.9.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ let package = Package(
1616
.library(name: "SmartNetwork", targets: ["SmartNetwork"])
1717
],
1818
dependencies: [
19-
.package(url: "https://github.com/NikSativa/SpryKit.git", .upToNextMinor(from: "3.0.2")),
20-
.package(url: "https://github.com/NikSativa/Threading.git", .upToNextMinor(from: "2.1.1"))
19+
.package(url: "https://github.com/NikSativa/SpryKit.git", from: "3.0.4"),
20+
.package(url: "https://github.com/NikSativa/Threading.git", from: "2.2.0")
2121
],
2222
targets: [
2323
.target(name: "SmartNetwork",

Source/Address/AddressDetails+URL.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ internal extension AddressDetails {
3838
components.queryItems = result
3939
}
4040

41-
if let fragment = fragment {
41+
if let fragment {
4242
components.fragment = fragment
4343
}
4444

Source/Address/AddressDetails.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ private extension AddressDetails {
100100
path.isEmpty ? nil : "/",
101101
path.joined(separator: "/"),
102102
queryItems.isEmpty ? nil : "?",
103-
queryItems.mapToDescription().map {
104-
if let value = $0.value {
105-
return "\($0.key)=\(value)"
103+
queryItems.mapToDescription()
104+
.map {
105+
if let value = $0.value {
106+
return "\($0.key)=\(value)"
107+
}
108+
return $0.key
106109
}
107-
return $0.key
108-
}.joined(separator: "&"),
110+
.joined(separator: "&"),
109111
fragment.map { "#\($0)" }
110112
]
111113

Source/CURLConvertible.swift

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public extension CURLConvertible {
7272
guard let user = credential.user, let password = credential.password else {
7373
continue
7474
}
75+
7576
components.append("-u \(user):\(password)")
7677
}
7778
}
@@ -114,14 +115,14 @@ public extension CURLConvertible {
114115
}
115116

116117
if let httpBodyData = request.httpBody {
117-
let httpBody: String
118-
if prettyPrinted,
119-
let json = try? JSONSerialization.jsonObject(with: httpBodyData),
120-
let prettyData = try? JSONSerialization.data(withJSONObject: json, options: [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]) {
121-
httpBody = .init(decoding: prettyData, as: UTF8.self)
122-
} else {
123-
httpBody = .init(decoding: httpBodyData, as: UTF8.self)
124-
}
118+
let httpBody: String =
119+
if prettyPrinted,
120+
let json = try? JSONSerialization.jsonObject(with: httpBodyData),
121+
let prettyData = try? JSONSerialization.data(withJSONObject: json, options: [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]) {
122+
.init(decoding: prettyData, as: UTF8.self)
123+
} else {
124+
.init(decoding: httpBodyData, as: UTF8.self)
125+
}
125126

126127
components.append("-d '\(httpBody)'")
127128
}

Source/Content/DecodableContent.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ struct DecodableContent<Response: Decodable>: Deserializable {
2929

3030
do {
3131
let decoder = decoder?() ?? .init()
32-
let result: Response
33-
if keyPath.path.isEmpty {
34-
result = try decoder.decode(Response.self, from: data)
35-
} else {
36-
result = try data.decode(Response.self, keyPath: keyPath.path, decoder: decoder)
37-
}
32+
let result: Response =
33+
if keyPath.path.isEmpty {
34+
try decoder.decode(Response.self, from: data)
35+
} else {
36+
try data.decode(Response.self, keyPath: keyPath.path, decoder: decoder)
37+
}
3838
return .success(result)
3939
} catch {
4040
switch keyPath.fallback {

Source/Error/RequestDecodingError.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,19 @@ extension RequestDecodingError: RequestErrorDescription {
3030
case .other(let encodingError):
3131
let description = (encodingError as NSError).description
3232
return ".other(\(description))"
33+
3334
case .brokenImage:
3435
return "brokenImage"
36+
3537
case .brokenResponse:
3638
return "brokenResponse"
39+
3740
case .nilResponse:
3841
return "nilResponse"
42+
3943
case .emptyResponse:
4044
return "emptyResponse"
45+
4146
case .brokenKeyPath(let key):
4247
return "brokenKeyPath(\(key))"
4348
}

Source/Error/RequestEncodingError.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,19 @@ extension RequestEncodingError: RequestErrorDescription {
3131
case .other(let encodingError):
3232
let description = (encodingError as NSError).description
3333
return ".other(\(description))"
34+
3435
case .brokenURL:
3536
return "brokenURL"
37+
3638
case .brokenAddress:
3739
return "brokenAddress"
40+
3841
case .brokenHost:
3942
return "brokenHost"
43+
4044
case .cantEncodeImage:
4145
return "cantEncodeImage"
46+
4247
case .invalidJSON:
4348
return "invalidJSON"
4449
}

Source/Error/RequestError.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,25 @@ extension RequestError: RequestErrorDescription {
6565
switch self {
6666
case .generic:
6767
return "generic"
68+
6869
case .other(let error):
69-
let description: String
70-
if let subname = (error as? RequestErrorDescription)?.subname {
71-
description = subname
72-
} else {
73-
description = (error as NSError).description
74-
}
70+
let description: String =
71+
if let subname = (error as? RequestErrorDescription)?.subname {
72+
subname
73+
} else {
74+
(error as NSError).description
75+
}
7576
return "other(\(description))"
77+
7678
case .connection(let error):
7779
return "connection(URLError \(error.code.rawValue))"
80+
7881
case .encoding(let error):
7982
return "encoding(.\(error.subname))"
83+
8084
case .decoding(let error):
8185
return "decoding(.\(error.subname))"
86+
8287
case .statusCode(let error):
8388
return "statusCode(.\(error.subname))"
8489
}

0 commit comments

Comments
 (0)