定义了四种类型用于保存请求返回的数据
DefaultDataResponse
一般DataRequest对应的response
public struct DefaultDataResponse {
/// The URL request sent to the server.
public let request: URLRequest?
/// The server's response to the URL request.
public let response: HTTPURLResponse?
/// The data returned by the server.
public let data: Data?
/// The error encountered while executing or validating the request.
public let error: Error?
/// The timeline of the complete lifecycle of the request.
public let timeline: Timeline
var _metrics: AnyObject?
init(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?, timeline: Timeline = Timeline()) {
self.request = request
self.response = response
self.data = data
self.error = error
self.timeline = timeline
}
}
DataResponse<Value>
和defauleDataRequest基本没有差别只是有一个泛型属性
DefaultDownloadResponse,DownloadResponse<Value>
和上面的dataresponse
一样的作用
网友评论