<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Quartz",
  "identifier" : "/documentation/Quartz/IKScannerDeviceViewDelegate/scannerDeviceView(_:didScanTo:fileData:error:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Quartz"
    ],
    "preciseIdentifier" : "c:objc(pl)IKScannerDeviceViewDelegate(im)scannerDeviceView:didScanToURL:fileData:error:"
  },
  "title" : "scannerDeviceView(_:didScanTo:fileData:error:)"
}
-->

# scannerDeviceView(_:didScanTo:fileData:error:)

Invoked when the scan has completed and the data is available.

```
optional func scannerDeviceView(_ scannerDeviceView: IKScannerDeviceView!, didScanTo url: URL!, fileData data: Data!, error: (any Error)!)
```

## Parameters

`scannerDeviceView`

The scanner device that sent the message.

`url`

The URL to save the data.

`data`

The data from the scan.

`error`

Any error encountered during the scan.

## Discussion

This method is called when the scan has completed..

If the `scannerDeviceView` [`transferMode`](/documentation/Quartz/IKScannerDeviceView/transferMode) is [`IKScannerDeviceViewTransferMode.fileBased`](/documentation/Quartz/IKScannerDeviceViewTransferMode/fileBased), the scan will have been saved at the specified `url`. The URL will be in the download directory and be a complete path, including a ‘sequence number’ if the file already exists.

If the `scannerDeviceView` [`transferMode`](/documentation/Quartz/IKScannerDeviceView/transferMode) is [`IKScannerDeviceViewTransferMode.memoryBased`](/documentation/Quartz/IKScannerDeviceViewTransferMode/memoryBased), the scanned data is contained in the data parameter. You can then take the action appropriate to your application.

In case of an error, the parameters (`url` and `data`) will be `NULL` and `error` (which may come directly from the scanner module / or the ImageCaptureCore framework) will describe why the scan or save failed.

---

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)