Data
extension Data
-
Result Tuple/Pair with information about the write action. Where it was written and what was written.
Declaration
Swift
public typealias WriteResult = (url: URL, data: Data)
-
Save Data to file and capture response/exception in Result
Declaration
Swift
public func save(to file: URL, options: WritingOptions = .atomicWrite) -> Result<WriteResult, Error>
Parameters
file
the URL file/path to write to
options
Writing settings. Default: .atomicWrite
Return Value
Result of the write by returning the URL and self upon success.
-
Representation for empty/no-data state.
Note
Used when we don’t want an optional.Declaration
Swift
public static let empty: Data