TruMan1
TruMan1

Reputation: 36178

Present native iOS document scanner?

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?

Upvotes: 3

Views: 635

Answers (1)

jt_uk
jt_uk

Reputation: 1532

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)

Upvotes: 1

Related Questions