|
|
|
|
@ -27,10 +27,11 @@ public class StoredSingleton<T: SyncedStorable>: SyncedCollection<T> { |
|
|
|
|
return self.items.first |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@discardableResult public func tryPutBeforeUpdating(_ instance: T) async throws -> T? { |
|
|
|
|
public func tryPutBeforeUpdating(_ instance: T) async throws { |
|
|
|
|
let result = try await StoreCenter.main.service().rawPut(instance) |
|
|
|
|
self.setItemNoSync(result) |
|
|
|
|
return result |
|
|
|
|
if let item = self.item() { |
|
|
|
|
item.copy(from: result) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// MARK: - Protects from use |
|
|
|
|
|