FileBackedDictionary
public struct FileBackedDictionary<T> where T : Decodable, T : Encodable
-
Declaration
Swift
private(set) var dictionary: [String : T] { get }
-
Initialize the backed-up storage
Remark
if the directory for the backup files does not exist, creates it. Initiallizes the local dict from files in the directory (if any)Declaration
Swift
public init(directoryName: String)
Parameters
directoryName
names the backup directory
-
Declaration
Swift
public static func deleteDirectory(named directoryName: String)
-
Support for dictionary style setting and getting of a value by key
Declaration
Swift
public subscript(key: String) -> T? { get set }
-
Return sorted keys
Declaration
Swift
public var keys: [String] { get }
-
Return values sorted by keys
Declaration
Swift
public var values: [T] { get }
-
Remove the value for key from the dictionary and from the file
Declaration
Swift
public mutating func removeValue(forKey key: String) throws
Parameters
forKey
key
-
Remove all values from dictionary and from files
Declaration
Swift
public mutating func removeAll()
-
Return names of backing files (sorted)
Declaration
Swift
public var fileNames: [String] { get }
-
Return the dictionary item count
Declaration
Swift
public var count: Int { get }