DownloadStatus
extension DownloadStatus
-
Initialize a
DownloadStatusDeclaration
Swift
public convenience init(downloadId: UInt64, state: DownloadState, error: DownloadError?, totalBytes: UInt64?, receivedBytes: UInt64, transferredBytes: UInt64, downloadOptions: DownloadOptions, httpResult: Result<HttpResponseData, HttpRequestError>?)Parameters
downloadIdDownload id which was created by download request.
stateState of download request.
errorContains error information in case of failure when state is set to
DownloadState.failed.totalBytesTotal amount of bytes to receive. In some cases this value is unknown until we get final part of the file.
receivedBytesAmount of bytes already received and saved on the disk. Includes previous download attempts for a resumed download.
transferredBytesAmount of bytes received during the current resume attempt. For downloads that weren’t resumed, this value will be the same as receivedBytes.
downloadOptionsDownload options used to send the download request.
httpResultAn optional HTTP result. This field is only set for
DownloadState.failedandDownloadState.finished. For.failedexpectHttpRequestErrorto be provided for cases whenDownloadErrorCodeisNetworkError. For.finishedHttpResponseDatais set, but with empty data field (since all the data was written to the disk). -
Convenience to initialize a
DownloadStatuswhen the download state is.pendingDeclaration
Swift
public convenience init(error: DownloadError?, totalBytes: UInt64?, downloadOptions: DownloadOptions, httpResult: Result<HttpResponseData, HttpRequestError>?)Parameters
errorContains error information in case of failure when state is set to
DownloadState.failed.totalBytesTotal amount of bytes to receive. In some cases this value is unknown until we get final part of the file.
downloadOptionsDownload options used to send the download request.
httpResultAn optional HTTP result. This field is only set for
DownloadState.failedandDownloadState.finished. For.failedexpectHttpRequestErrorto be provided for cases whenDownloadErrorCodeisNetworkError. For.finishedHttpResponseDatais set, but with empty data field (since all the data was written to the disk). -
HTTP result. This field is only set for
DownloadState.failedandDownloadState.finished.For
.failedexpectHttpRequestErrorto be provided for cases whenDownloadErrorCodeisNetworkError. And for.finishedHttpResponseDatais set, but with empty data field (since all the data was written to the disk).Declaration
Swift
public var httpResult: Result<HttpResponseData, HttpRequestError>? { get } -
Total amount of bytes to receive. In some cases this value is unknown until we get final part of the file being downloaded.
Declaration
Swift
public var totalBytes: UInt64? { get }
DownloadStatus Extension Reference