DataUploadable
public protocol DataUploadable: ADataUploadable, Uploadable
Represents a DataUploadable
for Restofire.
Create custom DataUploadable
protocol HTTPBinUploadService: DataUploadable {
var path: String? = "post"
var data: Data = {
return "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
.data(using: .utf8, allowLossyConversion: false)!
}()
}
-
response(_:)
Extension methodCreates a
UploadOperation
for the specifiedUploadable
object and asynchronously executes it.Declaration
Swift
public func response(_ 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
.