Files
helder/Tests/HelderUITests/Support/Fakes/FakeSchemaLayouts.swift
T

17 lines
620 B
Swift

import Foundation
import HelderCore
import HelderServices
/// Schema card positions per project, in memory instead of UserDefaults.
final class FakeSchemaLayouts: SchemaLayoutPersisting, @unchecked Sendable {
private let state = Locked([String: [String: SchemaPoint]]())
var saved: [String: [String: SchemaPoint]] {
get { state.current }
set { state.mutate { $0 = newValue } }
}
func loadPositions(root: String) -> [String: SchemaPoint] { state.current[root] ?? [:] }
func savePositions(_ positions: [String: SchemaPoint], root: String) { state.mutate { $0[root] = positions } }
}