<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "VisionKit",
  "identifier" : "/documentation/VisionKit/DataScannerViewController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "VisionKit"
    ],
    "preciseIdentifier" : "c:@M@VisionKit@objc(cs)DataScannerViewController"
  },
  "title" : "DataScannerViewController"
}
-->

# DataScannerViewController

An object that scans the camera live video for text, data in text, and
machine-readable codes.

```
@MainActor @objc class DataScannerViewController
```

## Overview

Use a `DataScannerViewController` object to get input from physical objects
that appear in the camera’s live video, such as printed text and QR codes on
packages.

Create a data scanner by passing parameters that configure the interface to
the
[`init(recognizedDataTypes:qualityLevel:recognizesMultipleItems:isHighFrameRateTrackingEnabled:isPinchToZoomEnabled:isGuidanceEnabled:isHighlightingEnabled:)`](/documentation/VisionKit/DataScannerViewController/init(recognizedDataTypes:qualityLevel:recognizesMultipleItems:isHighFrameRateTrackingEnabled:isPinchToZoomEnabled:isGuidanceEnabled:isHighlightingEnabled:))
initializer. Then set its delegate to an object in your app that implements
the [`DataScannerViewControllerDelegate`](/documentation/VisionKit/DataScannerViewControllerDelegate) protocol.

Before presenting the view controller, check whether the data scanner is
available using the [`isSupported`](/documentation/VisionKit/DataScannerViewController/isSupported) and
[`isAvailable`](/documentation/VisionKit/DataScannerViewController/isAvailable) properties. Before you can use the
data scanner, you must provide a reason for using the camera (add the
<doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/NSCameraUsageDescription>
key to the information property list), and a person must agree when the
system dialog first appears.

Then begin data scanning by invoking the
[`startScanning()`](/documentation/VisionKit/DataScannerViewController/startScanning()) method and implement the
[`dataScanner(_:didTapOn:)`](/documentation/VisionKit/DataScannerViewControllerDelegate/dataScanner(_:didTapOn:)) and
similar delegate methods to handle user actions. Use the [`RecognizedItem`](/documentation/VisionKit/RecognizedItem)
parameter passed to these methods to perform data-specific actions. For
example, if the item is a QR code, perform an action with its payload
string, such as opening a URL in a browser, or calling a phone number.

Alternatively, you can track items that appear in the live video using the
asynchronous [`recognizedItems`](/documentation/VisionKit/DataScannerViewController/recognizedItems) array.

## Topics

### Handling availability

[`isSupported`](/documentation/VisionKit/DataScannerViewController/isSupported)

A Boolean value that indicates whether the device supports data
scanning.

[`isAvailable`](/documentation/VisionKit/DataScannerViewController/isAvailable)

A Boolean value that indicates whether a person grants your app access
to the camera and doesn’t have any restrictions to using the camera.

[`supportedTextRecognitionLanguages`](/documentation/VisionKit/DataScannerViewController/supportedTextRecognitionLanguages)

The identifiers for the languages that the data scanner recognizes.

[`ScanningUnavailable`](/documentation/VisionKit/DataScannerViewController/ScanningUnavailable)

The possible reasons the data scanner is unavailable.

### Creating data scanners

[`init(recognizedDataTypes:qualityLevel:recognizesMultipleItems:isHighFrameRateTrackingEnabled:isPinchToZoomEnabled:isGuidanceEnabled:isHighlightingEnabled:)`](/documentation/VisionKit/DataScannerViewController/init(recognizedDataTypes:qualityLevel:recognizesMultipleItems:isHighFrameRateTrackingEnabled:isPinchToZoomEnabled:isGuidanceEnabled:isHighlightingEnabled:))

Creates a scanner for finding data, such as text and machine-readable
codes, in the camera’s live video.

[`recognizedDataTypes`](/documentation/VisionKit/DataScannerViewController/recognizedDataTypes)

The types of data that the data scanner identifies in the live video.

[`RecognizedDataType`](/documentation/VisionKit/DataScannerViewController/RecognizedDataType)

A type of data that the scanner recognizes.

### Configuring data scanners

[`delegate`](/documentation/VisionKit/DataScannerViewController/delegate)

The delegate that handles user interaction with items recognized by the
data scanner.

[`qualityLevel`](/documentation/VisionKit/DataScannerViewController/qualityLevel-swift.property)

The resolution that the scanner uses to find data.

[`QualityLevel`](/documentation/VisionKit/DataScannerViewController/QualityLevel-swift.enum)

The possible quality levels that the scanner uses to find data.

[`recognizesMultipleItems`](/documentation/VisionKit/DataScannerViewController/recognizesMultipleItems)

A Boolean value that indicates whether the scanner should identify all
items in the live video.

[`isHighFrameRateTrackingEnabled`](/documentation/VisionKit/DataScannerViewController/isHighFrameRateTrackingEnabled)

A Boolean value that determines the frequency at which the scanner
updates the geometry of recognized items.

[`isPinchToZoomEnabled`](/documentation/VisionKit/DataScannerViewController/isPinchToZoomEnabled)

A Boolean value that indicates whether people can use a two-finger
pinch-to-zoom gesture.

[`isGuidanceEnabled`](/documentation/VisionKit/DataScannerViewController/isGuidanceEnabled)

A Boolean value that indicates whether the scanner provides help to a
person when selecting items.

[`isHighlightingEnabled`](/documentation/VisionKit/DataScannerViewController/isHighlightingEnabled)

A Boolean value that indicates whether the scanner displays highlights
around recognized items.

### Zooming

[`zoomFactor`](/documentation/VisionKit/DataScannerViewController/zoomFactor)

The zoom factor for the live video in the camera.

[`minZoomFactor`](/documentation/VisionKit/DataScannerViewController/minZoomFactor)

The minimum zoom factor that the camera supports.

[`maxZoomFactor`](/documentation/VisionKit/DataScannerViewController/maxZoomFactor)

The maximum zoom factor that the camera supports.

### Scanning and recognizing items

[`startScanning()`](/documentation/VisionKit/DataScannerViewController/startScanning())

Starts scanning the camera’s live video for data.

[`stopScanning()`](/documentation/VisionKit/DataScannerViewController/stopScanning())

Stops scanning the camera’s live video for data.

[`isScanning`](/documentation/VisionKit/DataScannerViewController/isScanning)

A Boolean value that indicates whether the data scanner is actively looking
for items.

[`recognizedItems`](/documentation/VisionKit/DataScannerViewController/recognizedItems)

An asynchronous array of items that the data scanner currently
recognizes in the camera’s live video.

### Capturing photos

[`capturePhoto()`](/documentation/VisionKit/DataScannerViewController/capturePhoto())

Captures a high-resolution photo of the camera’s live video.

### Customizing the interface

[`overlayContainerView`](/documentation/VisionKit/DataScannerViewController/overlayContainerView)

A view that the data scanner displays over its view without interfering
with the Live Text interface.

[`regionOfInterest`](/documentation/VisionKit/DataScannerViewController/regionOfInterest)

The area of the live video in view coordinates that the data scanner
searches for items.

### Responding to view controller events

[`loadView()`](/documentation/VisionKit/DataScannerViewController/loadView())

Creates the view that the controller manages.

[`viewDidLoad()`](/documentation/VisionKit/DataScannerViewController/viewDidLoad())

Performs some action after the system loads the view into memory.

[`viewWillAppear(_:)`](/documentation/VisionKit/DataScannerViewController/viewWillAppear(_:))

Performs some action before the view appears.

[`viewDidDisappear(_:)`](/documentation/VisionKit/DataScannerViewController/viewDidDisappear(_:))

Performs some action after the view disappears.

[`removeFromParent()`](/documentation/VisionKit/DataScannerViewController/removeFromParent())

Removes the view controller from its parent.

## Relationships

### Conforms To

[`NSCoding`](/documentation/Foundation/NSCoding)

[`UIAppearanceContainer`](/documentation/UIKit/UIAppearanceContainer)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSExtensionRequestHandling`](/documentation/Foundation/NSExtensionRequestHandling)

[`UIResponderStandardEditActions`](/documentation/UIKit/UIResponderStandardEditActions)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Hashable`](/documentation/Swift/Hashable)

[`UITraitChangeObservable-67e94`](/documentation/UIKit/UITraitChangeObservable-67e94)

[`UIStateRestoring`](/documentation/UIKit/UIStateRestoring)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`UIUserActivityRestoring`](/documentation/UIKit/UIUserActivityRestoring)

[`UIFocusEnvironment`](/documentation/UIKit/UIFocusEnvironment)

[`UITraitEnvironment`](/documentation/UIKit/UITraitEnvironment)

[`UIPasteConfigurationSupporting`](/documentation/UIKit/UIPasteConfigurationSupporting)

[`UIActivityItemsConfigurationProviding`](/documentation/UIKit/UIActivityItemsConfigurationProviding)

[`UIContentContainer`](/documentation/UIKit/UIContentContainer)

### Inherits From

[`UIViewController`](/documentation/UIKit/UIViewController)

---

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)