Response
@objc public class Response: NSObject
A Response object represents the response from a network request.
-
A message for this response.
Declaration
Swift
public var message: String = "" -
Indicates if the request was successful or not.
Declaration
Swift
public var success: Bool = true -
If the response was unsuccessful this object will contain more information about the error.
Declaration
Swift
public var error: DarkMatterError? = nil -
The JSON data received with this response.
Declaration
Swift
public var data: JSON? = nil -
The HTTP headers received in the response.
Declaration
Swift
public var headers: [String: String] = [:] -
Initializes a successful
Responseobject with the given message.Declaration
Swift
public init(message: String)Parameters
messageThe message for this response.
-
Initializes a successful
Responseobject with default values.Declaration
Swift
public override init() -
Initializes a
Responseobject from the given AlamofireDataResponseobject. If the result.value object can’t be converted to a JSON object this response will be considered unsuccessful.Declaration
Swift
public init(response: DataResponse<Any>)Parameters
responseThe Alamofire
DataResponseobject to parse. -
Initializes a successful
Responseobject with the given JSON data.Declaration
Swift
public init(data: [String: AnyObject])Parameters
dataThe JSON object for the response.
-
Initializes a
Responseobject with the given values.Declaration
Swift
public init(success: Bool, message: String, error: DarkMatterError?, headers: [String: String], data: JSON?)Parameters
successtrueif this is a successful response.messageThe message for this response.
errorThe error that occurred if the response was unsuccessful.
headersThe HTTP headers received with the response.
dataThe JSON data received with the response.
Response Class Reference