From c45c6eff0e079e20652e39bf6e6581f192bb3dd7 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 2 Apr 2024 21:25:41 -0700 Subject: [PATCH] Convert Account.update(feed, parsedFeed) to async await. --- Account/Sources/Account/Account.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Account/Sources/Account/Account.swift b/Account/Sources/Account/Account.swift index 80f5796c9..e986f3147 100644 --- a/Account/Sources/Account/Account.swift +++ b/Account/Sources/Account/Account.swift @@ -826,6 +826,21 @@ public enum FetchType { } } + @discardableResult + func update(_ feed: Feed, with parsedFeed: ParsedFeed) async throws -> ArticleChanges { + + try await withCheckedThrowingContinuation { continuation in + self.update(feed, with: parsedFeed) { result in + switch result { + case .success(let articleChanges): + continuation.resume(returning: articleChanges) + case .failure(let error): + continuation.resume(throwing: error) + } + } + } + } + func update(_ feed: Feed, with parsedFeed: ParsedFeed, _ completion: @escaping UpdateArticlesCompletionBlock) { // Used only by an On My Mac or iCloud account. precondition(Thread.isMainThread)