FileStorage
public final class FileStorage<T> where T : Decodable, T : Encodable
FileStorage allow to store data
Important
This is a Public Preview API. It may be changed or removed at any time.-
Static method to cache a file.
Declaration
Swift
public class func cache(fileName: String) -> FileStorageParameters
fileNameFile name where it will be stored.
Return Value
FileStorageobject. -
Static method to persist a file.
Declaration
Swift
public class func persist(fileName: String) -> FileStorageParameters
fileNameFile name where it will be stored.
Return Value
FileStorageobject. -
Method used to save the current state of a class.
Declaration
Swift
@discardableResult public func save(data: T) -> FileStorageError?Parameters
dataGeneric type implementing the
Codableprotocol.Return Value
If saving is successful, the returned value will be
nil. If saving fails, the function will return aFileStorageError. -
Method used to load the last state of a saved class.
Declaration
Swift
public func loadData() -> (Result<T, FileStorageError>)Return Value
If loading is successful load, the returned value will be the data. If loading fails, the function will return a
FileStorageError. -
Method used to clear the storaged data.
Declaration
Swift
public func clear()
FileStorage Class Reference