UploadTask
public final class UploadTask<Method> : Cancellable where Method : PCloudAPIMethod
extension UploadTask: CustomStringConvertible
Executes an upload to the pCloud API.
-
Undocumented
Declaration
Swift
public typealias Parser = Method.Parser -
Undocumented
Declaration
Swift
public typealias CompletionBlock = (Result<Method.Value, CallError<Method.Error>>) -> Void -
trueifcancel()has been invoked on this instance,falseotherwise.Declaration
Swift
public var isCancelled: Bool { get } -
Initializes a non-running task with a network operation and a parser.
Declaration
Swift
public init(operation: UploadOperation, responseParser: @escaping Parser)Parameters
operationAn operation in a suspended state that would execute the upload.
responseParserA block parsing an object from a response dictionary.
-
Adds a completion block to this instance to be called when the task completes either successfully or with a failure.
Declaration
Swift
@discardableResult public func addCompletionBlock(_ block: @escaping CompletionBlock) -> UploadTaskParameters
blockA block called on the main thread with the result of the task.
Return Value
This task.
-
Adds a progress block to this instance to be called continuously as data is being uploaded.
Declaration
Swift
@discardableResult public func addProgressBlock(_ block: @escaping (Int64, Int64) -> Void) -> UploadTaskParameters
blockA block called on the main thread with the number of uploaded bytes and the total number of bytes to upload as first and second arguments, respectively. Called each time the number of uploaded bytes changes.
Return Value
This task.
-
Starts the task if it is not already running.
Declaration
Swift
@discardableResult public func start() -> UploadTaskReturn Value
This task.
-
Interrupts and invalidates the task. An invalidated task cannot run again.
Declaration
Swift
public func cancel() -
Declaration
Swift
public var description: String { get }
View on GitHub
UploadTask Class Reference