LocalFileStorable
public protocol LocalFileStorable
an object that can be represented and stored as a local file
-
specifies the data structure that will be stored
Declaration
Swift
associatedtype Element : Reflectable, Comparable, Decodable, Encodable, Hashable, Identifiable
-
defines the data that will be stored
Declaration
Swift
var wrappedValue: [Element] { get set }
-
defines a
String
that characterizes the unique attributes of thewrappedValue
Declaration
Swift
var storagePath: String { get }
-
localStorageURL
Extension methodURL
of the parent folder to store the variable inDeclaration
Swift
public var localStorageURL: URL { get }
-
loadFromFile()
Extension methodLoad an array of
LocalFileStorables
from a fileDeclaration
Swift
public func loadFromFile() -> [Element]
Return Value
an array of decoded objects
-
saveToFile(_:
Extension method) Save a collection of
LocalFileStorables
to a fileDeclaration
Swift
public func saveToFile(_ collection: [Element])
Parameters
collection
Collection
of objects that should be saved