Reputation: 61
Just wondering if anyone knows how to add an action for when the user presses the save button in a VNDocumentCameraViewController. I just want the user to only be able to scan one document, then the view should dismiss itself.
I've got this function at the moment ...
@objc func scanDocument() {
let scannerViewController = VNDocumentCameraViewController()
scannerViewController.delegate = self
present(scannerViewController, animated: true)
}
Along with two actions, both formatted like ...
func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {
}
but there doesn't seem to be an action in that same format for 'DidPressSave' or something like that, there is only 'didFailWithError.' I even jumped to the definition and found that they only have those two. So was wondering if there is that way to add that kind of action or to limit the user to only one scan?
Thanks, Jordan.
Upvotes: 3
Views: 1559
Reputation: 377
There is no way to set limit of pages to scan at this moment.
You can see it on documentation of class VNDocumentCameraViewController and delegate VNDocumentCameraViewControllerDelegate.
If you want you can try to use WeScan
Upvotes: 2
Reputation: 2268
From Apple documentations
The delegate will receive one of the following calls, depending whether the user saves or cancels, or if the session fails.
- (void)documentCameraViewController:(VNDocumentCameraViewController *)controller didFinishWithScan:(VNDocumentCameraScan *)scan;
Upvotes: 0