MultipartUploadable

public protocol MultipartUploadable: AMultipartUploadable, Uploadable

Represents a MultipartUploadable for Restofire.

Create custom MultipartUploadable

protocol HTTPBinUploadService: MultipartUploadable {

    var path: String? = "post"
    var multipartFormData: (MultipartFormData) -> Void = { multipartFormData in
        multipartFormData.append("français".data(using: .utf8)!, withName: "french")
        multipartFormData.append("日本語".data(using: .utf8)!, withName: "japanese")
    }

}
  • response(_:) Extension method

    Use response(request: UploadRequest, completionHandler: ((DataResponse) -> Void)? = nil) method for MultipartUpload instead

    Declaration

    Swift

    public func response(_ completionHandler: ((DataResponse<Response>) -> Void)?) -> UploadOperation<Self>
  • Creates a UploadOperation for the specified Uploadable object and asynchronously executes it.

    Declaration

    Swift

    public func response(request: UploadRequest, completionHandler: ((DataResponse<Response>) -> Void)? = nil) -> UploadOperation<Self>

    Parameters

    request

    An Alamofire.UploadRequest.

    completionHandler

    A closure to be executed once the download has finished. nil by default.

    Return Value

    The created UploadOperation.