NetworkResult
protocol NetworkResult
This protocol defines the default layout of the NetworkResult after a NetworkOperation has completed. It allows for room to grow and any custom implementation to be provided
-
A network status code often used to hold a value such as a 200 or 404 as found on typical HTTP operations.
Declaration
Swift
var code: Int { get }
-
Any data associated with the result; can be in any format
Declaration
Swift
var data: Data? { get }
-
A status flag indicating whether the result was successful, a failure or in progress
Declaration
Swift
var status: NetworkStatus { get }
-
stringFormat
Default implementationA shorthand alternative to the
Data
representation; the default implementation of this getter returns aString(data: data, encoding: .utf8)
version of the internal.data
propertyDefault Implementation
Default implementation of the variable simply converts the internal data value to a String using
String(date:,encoding:)
. If this behavior isn’t sufficient overload the variable with a different getterDeclaration
Swift
var stringFormat: String? { get }