Convert Account.update(feed, parsedFeed) to async await.

This commit is contained in:
Brent Simmons 2024-04-02 21:25:41 -07:00
parent 69fd496576
commit c45c6eff0e

View File

@ -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)