Uploadable

public protocol Uploadable: _AUploadable, Configurable, DataResponseSerializable

Represents an abstract Uploadable for Restofire.

Instead implement FileUploadable, DataUploadable, StreamUploadable, MultipartUplodable protocols.

  • request(_:didCompleteWithValue:) Default implementation

    Called when the Request succeeds.

    Default Implementation

    Does Nothing

    Declaration

    Swift

    func request(_ request: UploadOperation<Self>, didCompleteWithValue value: Response)

    Parameters

    request

    The Alamofire.UploadRequest

    value

    The Response

  • request(_:didFailWithError:) Default implementation

    Called when the Request fails

    Default Implementation

    Does Nothing

    Declaration

    Swift

    func request(_ request: UploadOperation<Self>, didFailWithError error: Error)

    Parameters

    request

    The Alamofire.UploadRequest

    error

    The Error

  • execute(completionHandler:) Extension method

    Creates a UploadOperation for the specified Uploadable object and asynchronously executes it.

    Declaration

    Swift

    public func execute(completionHandler: ((DataResponse<Response>) -> Void)? = nil) -> UploadOperation<Self>

    Parameters

    completionHandler

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

    Return Value

    The created UploadOperation.

  • Creates a UploadOperation for the specified Uploadable object and asynchronously executes it.

    Declaration

    Swift

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

    Parameters

    request

    An upload request instance

    completionHandler

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

    Return Value

    The created UploadOperation.