Present native iOS document scanner?

Viewed 377

iOS 11 has a built in document scanner that you can launch from Notes. I’d like to scan documents for my app, is there a way to present the native document scanner and receive its images?

1 Answers

This is now available in iOS 13+ and is provided through the VisionKit API.

Present the VNDocumentCameraViewController view controller, registering the VNDocumentCameraViewControllerDelegate delegate:

let documentCameraViewController = VNDocumentCameraViewController()
documentCameraViewController.delegate = self
present(documentCameraViewController, animated: true)

Then receive the delegate calls once a document has been successfully captured by the user:

documentCameraViewController(_ controller: VNDocumentCameraViewController, 
                       didFinishWith scan: VNDocumentCameraScan)
Related