---
title: "download(_:didWriteBytes:totalBytesWritten:totalBytesExpectedToWrite:)"
framework: backgroundassets
role: symbol
role_heading: Instance Method
path: "backgroundassets/badownloadmanagerdelegate/download(_:didwritebytes:totalbyteswritten:totalbytesexpectedtowrite:)"
---

# download(_:didWriteBytes:totalBytesWritten:totalBytesExpectedToWrite:)

Informs the delegate about the progress of the specified asset download.

## Declaration

```swift
optional func download(_ download: BADownload, didWriteBytes bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite totalExpectedBytes: Int64)
```

## Parameters

- `download`: The associated asset download.
- `bytesWritten`: The number of bytes the system writes to disk for the asset download since the previous execution of this method.
- `totalBytesWritten`: The total number of bytes the system writes to disk for the asset download.
- `totalExpectedBytes`: The total size, in bytes, that the framework expects to receive for the asset download.

## Discussion

Discussion Because the framework may be processing several asset downloads at once, it may call this method frequently and for different downloads. Cache an asset download’s uniqueIdentifier when you first schedule it, and then match the identifier against the same property on download so you can track the individual progress of all in-progress downloads.

## See Also

### Reacting to download events

- [downloadDidBegin(_:)](backgroundassets/badownloadmanagerdelegate/downloaddidbegin(_:).md)
- [download(_:didReceive:completionHandler:)](backgroundassets/badownloadmanagerdelegate/download(_:didreceive:completionhandler:).md)
- [downloadDidPause(_:)](backgroundassets/badownloadmanagerdelegate/downloaddidpause(_:).md)
