Skip to content

Commit 20986b6

Browse files
authored
Add async/await support (#15)
* Add async/await support * Check for compiler version
1 parent 2f4cabb commit 20986b6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Package.swift

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import PackageDescription
55

66
let package = Package(
77
name: "PostgREST",
8+
platforms: [.iOS(.v11), .macOS(.v10_10)],
89
products: [
910
// Products define the executables and libraries a package produces, and make them visible to other packages.
1011
.library(

Sources/PostgREST/Concurrency.swift

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Foundation
2+
3+
#if compiler(>=5.5)
4+
@available(iOS 15.0.0, macOS 12.0.0, *)
5+
extension PostgrestBuilder {
6+
public func execute(head: Bool = false, count: CountOption? = nil) async throws -> PostgrestResponse {
7+
try await withCheckedThrowingContinuation { continuation in
8+
self.execute(head: head, count: count) { result in
9+
continuation.resume(with: result)
10+
}
11+
}
12+
}
13+
}
14+
#endif

0 commit comments

Comments
 (0)