<!--
{
  "availability" : [
    "iOS: 16.1.0 -",
    "iPadOS: 16.1.0 -",
    "macCatalyst: 16.1.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 18.4.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "BackgroundAssets",
  "identifier" : "/documentation/BackgroundAssets/BADownloadManagerDelegate/download(_:didWriteBytes:totalBytesWritten:totalBytesExpectedToWrite:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Background Assets"
    ],
    "preciseIdentifier" : "c:objc(pl)BADownloadManagerDelegate(im)download:didWriteBytes:totalBytesWritten:totalBytesExpectedToWrite:"
  },
  "title" : "download(_:didWriteBytes:totalBytesWritten:totalBytesExpectedToWrite:)"
}
-->

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

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

```
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

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`](/documentation/BackgroundAssets/BADownload/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)