From 86501db24e2bf1ecafefff6587a75d4b0c926c00 Mon Sep 17 00:00:00 2001 From: Darin Fisher Date: Mon, 18 Mar 2024 22:52:48 -0700 Subject: [PATCH] Fixup the signatures of clearPersistence and terminate (#53) While the underlying C++ layer does not generate errors for these calls, the Obj C API exposes errors on these calls, so we should here as well. --- Sources/FirebaseFirestore/Firestore+Swift.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/FirebaseFirestore/Firestore+Swift.swift b/Sources/FirebaseFirestore/Firestore+Swift.swift index 51209af..308ccdc 100644 --- a/Sources/FirebaseFirestore/Firestore+Swift.swift +++ b/Sources/FirebaseFirestore/Firestore+Swift.swift @@ -44,18 +44,18 @@ public class Firestore { } } - public func clearPersistence(completion: (() -> Void)?) { + public func clearPersistence(completion: ((Error?) -> Void)?) { let future = swift_firebase.swift_cxx_shims.firebase.firestore.firestore_clear_persistence(impl) future.setCompletion({ if let completion { DispatchQueue.main.async { - completion() + completion(nil) } } }) } - public func clearPersistence() async { + public func clearPersistence() async throws { await withCheckedContinuation { continuation in let future = swift_firebase.swift_cxx_shims.firebase.firestore.firestore_clear_persistence(impl) future.setCompletion({ @@ -64,18 +64,18 @@ public class Firestore { } } - public func terminate(completion: (() -> Void)?) { + public func terminate(completion: ((Error?) -> Void)?) { let future = swift_firebase.swift_cxx_shims.firebase.firestore.firestore_terminate(impl) future.setCompletion({ if let completion { DispatchQueue.main.async { - completion() + completion(nil) } } }) } - public func terminate() async { + public func terminate() async throws { await withCheckedContinuation { continuation in let future = swift_firebase.swift_cxx_shims.firebase.firestore.firestore_terminate(impl) future.setCompletion({