Skip to content

Commit 7209fdb

Browse files
authored
Merge pull request #68 from kean/fix-deprecations-xcode-14
Fix warnings in Xcode 14.1
2 parents e963abe + 2b26b87 commit 7209fdb

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
xcode: ["13.4.1", "13.3.1", "13.2.1"]
17+
xcode: ["14.1", "13.4.1", "13.2.1"]
1818
include:
19-
- xcode: "13.4.1"
19+
- xcode: "14.1"
2020
macos: macOS-12
21-
- xcode: "13.3.1"
21+
- xcode: "13.4.1"
2222
macos: macOS-12
2323
- xcode: "13.2.1"
2424
macos: macOS-11
@@ -42,16 +42,3 @@ jobs:
4242
- uses: actions/checkout@v2
4343
- name: Run Tests
4444
run: swift test
45-
46-
discover-typos:
47-
name: Discover Typos
48-
runs-on: macOS-12
49-
env:
50-
DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer
51-
steps:
52-
- uses: actions/checkout@v2
53-
- name: Discover typos
54-
run: |
55-
python3 -m pip install --upgrade pip
56-
python3 -m pip install codespell
57-
codespell --ignore-words-list="inout,theis" --skip="./.git,./.build/*,./Tests/GetTests/Mocker/*"

Sources/Get/DataLoader.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,45 @@ final class DataLoader: NSObject, URLSessionDataDelegate, URLSessionDownloadDele
2929
}()
3030

3131
func startDataTask(_ task: URLSessionDataTask, session: URLSession, delegate: URLSessionDataDelegate?) async throws -> Response<Data> {
32-
try await withTaskCancellationHandler(handler: { task.cancel() }) {
32+
try await withTaskCancellationHandler(operation: {
3333
try await withUnsafeThrowingContinuation { continuation in
3434
let handler = DataTaskHandler(delegate: delegate)
3535
handler.completion = continuation.resume(with:)
3636
self.handlers[task] = handler
3737

3838
task.resume()
3939
}
40-
}
40+
}, onCancel: {
41+
task.cancel()
42+
})
4143
}
4244

4345
func startDownloadTask(_ task: URLSessionDownloadTask, session: URLSession, delegate: URLSessionDownloadDelegate?) async throws -> Response<URL> {
44-
try await withTaskCancellationHandler(handler: { task.cancel() }) {
46+
try await withTaskCancellationHandler(operation: {
4547
try await withUnsafeThrowingContinuation { continuation in
4648
let handler = DownloadTaskHandler(delegate: delegate)
4749
handler.completion = continuation.resume(with:)
4850
self.handlers[task] = handler
4951

5052
task.resume()
5153
}
52-
}
54+
}, onCancel: {
55+
task.cancel()
56+
})
5357
}
5458

5559
func startUploadTask(_ task: URLSessionUploadTask, session: URLSession, delegate: URLSessionTaskDelegate?) async throws -> Response<Data> {
56-
try await withTaskCancellationHandler(handler: { task.cancel() }) {
60+
try await withTaskCancellationHandler(operation: {
5761
try await withUnsafeThrowingContinuation { continuation in
5862
let handler = DataTaskHandler(delegate: delegate)
5963
handler.completion = continuation.resume(with:)
6064
self.handlers[task] = handler
6165

6266
task.resume()
6367
}
64-
}
68+
}, onCancel: {
69+
task.cancel()
70+
})
6571
}
6672

6773
// MARK: - URLSessionDelegate

0 commit comments

Comments
 (0)