adds tryPutBeforeUpdating method

sync_v2
Laurent 7 months ago
parent c5f5c67737
commit 787d0d7366
  1. 7
      LeStorage/StoredSingleton.swift

@ -27,6 +27,13 @@ public class StoredSingleton<T: SyncedStorable>: SyncedCollection<T> {
return self.items.first
}
public func tryPutBeforeUpdating(_ instance: T) async throws {
if let result = try await StoreCenter.main.service().put(instance) {
self.setItemNoSync(result)
}
}
// MARK: - Protects from use
public override func addOrUpdate(contentOfs sequence: any Sequence<T>) {

Loading…
Cancel
Save