Skip to content

Commit

Permalink
Merge Compatibility patch for iOS 13.0+ #11
Browse files Browse the repository at this point in the history
  • Loading branch information
programVeins authored Jan 4, 2022
2 parents 6025944 + e0b005e commit ce4a2bc
Show file tree
Hide file tree
Showing 17 changed files with 886 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Sources/Typesense/Shared/Coders.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,21 @@ public struct SlowRequest: Codable {
case logSlowRequestsTimeMs = "log-slow-requests-time-ms"
}
}

@available(iOS, deprecated: 15.0, message: "Use the built-in API instead")
extension URLSession {
func data(for req: URLRequest) async throws -> (Data, URLResponse) {
try await withCheckedThrowingContinuation { continuation in
let task = self.dataTask(with: req) { data, response, error in
guard let data = data, let response = response else {
let error = error ?? URLError.invalidURL
return continuation.resume(throwing: error)
}

continuation.resume(returning: (data, response))
}

task.resume()
}
}
}
Binary file added example/UIKit/AlbumSearchUIKit/AlbumSearch.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ce4a2bc

Please sign in to comment.