DataRequest

  • Creates a response serializer that returns a SwiftyJSON object result type constructed from the response data using JSONSerialization with the specified reading options.

    Declaration

    Swift

    public static func serializeResponseSwiftyJSON(
        options: JSONSerialization.ReadingOptions = .allowFragments)
        -> DataResponseSerializer<JSON>

    Parameters

    options

    The JSON serialization reading options. Defaults to .allowFragments.

    Return Value

    A JSON object response serializer.

  • Adds a handler to be called once the request has finished.

    Declaration

    Swift

    @discardableResult
    public func responseSwiftyJSON(
        queue: DispatchQueue? = nil,
        options: JSONSerialization.ReadingOptions = .allowFragments,
        completionHandler: @escaping (DataResponse<JSON>) -> Void)
        -> Self

    Parameters

    options

    The JSON serialization reading options. Defaults to .allowFragments.

    completionHandler

    A closure to be executed once the request has finished.

    Return Value

    The request.