From f99e6b425c7f47c8fa89461532cf1c7b3d61b28a Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 2 Apr 2024 21:24:46 -0700 Subject: [PATCH] Add async version of FeedFinder.find. --- .../Sources/Account/FeedFinder/FeedFinder.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Account/Sources/Account/FeedFinder/FeedFinder.swift b/Account/Sources/Account/FeedFinder/FeedFinder.swift index 5640f2f7a..f4876000a 100644 --- a/Account/Sources/Account/FeedFinder/FeedFinder.swift +++ b/Account/Sources/Account/FeedFinder/FeedFinder.swift @@ -12,6 +12,20 @@ import Web class FeedFinder { + static func find(url: URL) async throws -> Set { + + try await withCheckedThrowingContinuation { continuation in + self.find(url: url) { result in + switch result { + case .success(let feedSpecifiers): + continuation.resume(returning: feedSpecifiers) + case .failure(let error): + continuation.resume(throwing: error) + } + } + } + } + static func find(url: URL, completion: @escaping (Result, Error>) -> Void) { downloadAddingToCache(url) { (data, response, error) in