Uploadable
public protocol Uploadable : Configurable, DataResponseSerializable, _AUploadable
Represents an abstract Uploadable
for Restofire.
Instead implement FileUploadable, DataUploadable, StreamUploadable, MultipartUplodable protocols.
-
request(_:didCompleteWithValue:)
Default implementationCalled 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 implementationCalled 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 methodCreates a
UploadOperation
for the specifiedUploadable
object and asynchronously executes it.Declaration
Swift
@discardableResult 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
. -
execute(request:completionHandler:)
Extension methodCreates a
UploadOperation
for the specifiedUploadable
object and asynchronously executes it.Declaration
Swift
@discardableResult 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
.