Skip to content

Commit cd03622

Browse files
authored
Merge pull request #98 from futuredapp/feature/drop-async-await-support
Drop async-await support for Xcode 13.0 and 13.1
2 parents 3d25c92 + 2779614 commit cd03622

4 files changed

Lines changed: 4 additions & 87 deletions

File tree

FTAPIKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "FTAPIKit"
3-
s.version = "1.4.1"
3+
s.version = "1.5.0"
44
s.summary = "Declarative, generic and protocol-oriented REST API framework using URLSession and Codable"
55
s.description = <<-DESC
66
Protocol-oriented framework for communication with REST APIs.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ When using Swift package manager install using Xcode 11+
2020
or add following line to your dependencies:
2121

2222
```swift
23-
.package(url: "https://github.com/futuredapp/FTAPIKit.git", from: "1.4.1")
23+
.package(url: "https://github.com/futuredapp/FTAPIKit.git", from: "1.5.0")
2424
```
2525

2626
When using CocoaPods add following line to your `Podfile`:
2727

2828
```ruby
29-
pod 'FTAPIKit', '~> 1.4'
29+
pod 'FTAPIKit', '~> 1.5'
3030
```
3131

3232
## Features

Sources/FTAPIKit/URLServer+Async.swift

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import Foundation
33
import FoundationNetworking
44
#endif
55

6-
// This extension is duplicated to support Xcode 13.0 and Xcode 13.1,
7-
// where backported concurrency is not available.
8-
96
// Support of async-await for Xcode 13.2+.
107
#if swift(>=5.5.2)
118
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
@@ -85,84 +82,4 @@ public extension URLServer {
8582
}
8683
}
8784
}
88-
89-
// Support of async-await for Xcode 13 and 13.1.
90-
#elseif swift(>=5.5)
91-
@available(macOS 12, iOS 15, watchOS 8, tvOS 15, *)
92-
public extension URLServer {
93-
94-
/// Performs call to endpoint which does not return any data in the HTTP response.
95-
/// - Note: This call maps ``call(endpoint:completion:)`` to the async/await API
96-
/// - Parameters:
97-
/// - endpoint: The endpoint
98-
/// - Throws: Throws in case that result is .failure
99-
/// - Returns: Void on success
100-
func call(endpoint: Endpoint) async throws {
101-
var task: URLSessionTask?
102-
return try await withTaskCancellationHandler {
103-
try await withCheckedThrowingContinuation { continuation in
104-
task = call(endpoint: endpoint) { result in
105-
switch result {
106-
case .success:
107-
continuation.resume()
108-
case .failure(let error):
109-
continuation.resume(throwing: error)
110-
}
111-
}
112-
}
113-
} onCancel: { [task] in
114-
task?.cancel()
115-
}
116-
}
117-
118-
/// Performs call to endpoint which returns an arbitrary data in the HTTP response, that should not be parsed by the decoder of the
119-
/// server.
120-
/// - Note: This call maps ``call(data:completion:)`` to the async/await API
121-
/// - Parameters:
122-
/// - endpoint: The endpoint
123-
/// - Throws: Throws in case that result is .failure
124-
/// - Returns: Plain data returned with the HTTP Response
125-
func call(data endpoint: Endpoint) async throws -> Data {
126-
var task: URLSessionTask?
127-
return try await withTaskCancellationHandler {
128-
try await withCheckedThrowingContinuation { continuation in
129-
task = call(data: endpoint) { result in
130-
switch result {
131-
case .success(let data):
132-
continuation.resume(returning: data)
133-
case .failure(let error):
134-
continuation.resume(throwing: error)
135-
}
136-
}
137-
}
138-
} onCancel: { [task] in
139-
task?.cancel()
140-
}
141-
}
142-
143-
/// Performs call to endpoint which returns data that are supposed to be parsed by the decoder of the instance
144-
/// conforming to ``Server`` in the HTTP response.
145-
/// - Note: This call maps ``call(response:completion:)`` to the async/await API
146-
/// - Parameters:
147-
/// - endpoint: The endpoint
148-
/// - Throws: Throws in case that result is .failure
149-
/// - Returns: Instance of the required type
150-
func call<EP: ResponseEndpoint>(response endpoint: EP) async throws -> EP.Response {
151-
var task: URLSessionTask?
152-
return try await withTaskCancellationHandler {
153-
try await withCheckedThrowingContinuation { continuation in
154-
task = call(response: endpoint) { result in
155-
switch result {
156-
case .success(let response):
157-
continuation.resume(returning: response)
158-
case .failure(let error):
159-
continuation.resume(throwing: error)
160-
}
161-
}
162-
}
163-
} onCancel: { [task] in
164-
task?.cancel()
165-
}
166-
}
167-
}
16885
#endif

Tests/FTAPIKitTests/AsyncTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if swift(>=5.5) && !os(Linux)
1+
#if swift(>=5.5.2) && !os(Linux)
22
import Foundation
33
import XCTest
44

0 commit comments

Comments
 (0)