From 69fd496576942036db342db4c7f4d252282a79b4 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 2 Apr 2024 21:25:05 -0700 Subject: [PATCH] Add async version of InitialFeedDownloader.download. --- .../Account/LocalAccount/InitialFeedDownloader.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Account/Sources/Account/LocalAccount/InitialFeedDownloader.swift b/Account/Sources/Account/LocalAccount/InitialFeedDownloader.swift index d1cd7b02c..2622f72de 100644 --- a/Account/Sources/Account/LocalAccount/InitialFeedDownloader.swift +++ b/Account/Sources/Account/LocalAccount/InitialFeedDownloader.swift @@ -12,6 +12,15 @@ import Web struct InitialFeedDownloader { + static func download(_ url: URL) async -> ParsedFeed? { + + await withCheckedContinuation { continuation in + self.download(url) { parsedFeed in + continuation.resume(returning: parsedFeed) + } + } + } + static func download(_ url: URL,_ completion: @escaping (_ parsedFeed: ParsedFeed?) -> Void) { downloadUsingCache(url) { (data, response, error) in