Skip to content

Commit

Permalink
Merge pull request #68 from kean/fix-deprecations-xcode-14
Browse files Browse the repository at this point in the history
Fix warnings in Xcode 14.1
  • Loading branch information
kean authored Nov 3, 2022
2 parents e963abe + 2b26b87 commit 7209fdb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
strategy:
fail-fast: false
matrix:
xcode: ["13.4.1", "13.3.1", "13.2.1"]
xcode: ["14.1", "13.4.1", "13.2.1"]
include:
- xcode: "13.4.1"
- xcode: "14.1"
macos: macOS-12
- xcode: "13.3.1"
- xcode: "13.4.1"
macos: macOS-12
- xcode: "13.2.1"
macos: macOS-11
Expand All @@ -42,16 +42,3 @@ jobs:
- uses: actions/checkout@v2
- name: Run Tests
run: swift test

discover-typos:
name: Discover Typos
runs-on: macOS-12
env:
DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Discover typos
run: |
python3 -m pip install --upgrade pip
python3 -m pip install codespell
codespell --ignore-words-list="inout,theis" --skip="./.git,./.build/*,./Tests/GetTests/Mocker/*"
18 changes: 12 additions & 6 deletions Sources/Get/DataLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,45 @@ final class DataLoader: NSObject, URLSessionDataDelegate, URLSessionDownloadDele
}()

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

task.resume()
}
}
}, onCancel: {
task.cancel()
})
}

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

task.resume()
}
}
}, onCancel: {
task.cancel()
})
}

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

task.resume()
}
}
}, onCancel: {
task.cancel()
})
}

// MARK: - URLSessionDelegate
Expand Down

0 comments on commit 7209fdb

Please sign in to comment.