Alamofire.DataRequest

Undocumented

  • Adds a handler that attempts to parse the result of the request into a Decodable

    Declaration

    Swift

    public func responseSerializable<T:Decodable>(_ completionHandler: @escaping (DataResponse<T>) -> Void, unwrapper:@escaping Parser.Unwrapper = Parser.defaultUnwrapper) -> Self

    Parameters

    completionHandler

    A closure that is invoked when the request is finished

    unwrapper

    A closure that extracts the data to be parsed from the JSON response data. The default implementation checks for a “data” field in the JSON response, then checks for a field with the same name as the target model. If not found, it passes the JSON response straight through.

    Return Value

    The request

  • Convenience method for a handler that does not need to parse the results of the network request.

    Declaration

    Swift

    public func responseSerializable(_ completionHandler: @escaping (DataResponse<NilSerializable>) -> Void) -> Self

    Parameters

    completionHandler

    A closure that is invoked when the request is finished

    Return Value

    The request