<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "VisionKit",
  "identifier" : "/documentation/VisionKit/VNDocumentCameraViewController/delegate",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "VisionKit"
    ],
    "preciseIdentifier" : "c:objc(cs)VNDocumentCameraViewController(py)delegate"
  },
  "title" : "delegate"
}
-->

# delegate

The delegate to be notified when the user saves or cancels the document scanner.

```
weak var delegate: (any VNDocumentCameraViewControllerDelegate)? { get set }
```

## Overview

The delegate receives one of the following three calls:

- [`documentCameraViewController(_:didFinishWith:)`](/documentation/VisionKit/VNDocumentCameraViewControllerDelegate/documentCameraViewController(_:didFinishWith:)) when the camera successfully completes a scan.
- [`documentCameraViewControllerDidCancel(_:)`](/documentation/VisionKit/VNDocumentCameraViewControllerDelegate/documentCameraViewControllerDidCancel(_:)) when the user cancels out of the document camera interface.
- [`documentCameraViewController(_:didFailWithError:)`](/documentation/VisionKit/VNDocumentCameraViewControllerDelegate/documentCameraViewController(_:didFailWithError:)) when the document scan fails or is unable to capture a photo.

Your app is responsible for dismissing the document camera in all delegate methods.

---

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)