Exporing the new VNDocumentCameraViewController
I cannot find any delegate or property to set the maximum number of scans.
Does anybody have a workaround or any idea I can implement to limit the number of scans in one go?
Exporing the new VNDocumentCameraViewController
I cannot find any delegate or property to set the maximum number of scans.
Does anybody have a workaround or any idea I can implement to limit the number of scans in one go?
I had the same issue, and I'm trying other alternatives. It's limited to 24 scans top. By default and it's not customizable
All you can do is call VNDocumentCameraViewControllerDelegate
and add this delegate method:
func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {
// Process the scanned pages
for pageNumber in 0..<scan.pageCount {
}
// You are responsible for dismissing the controller.
controller.dismiss(animated: true)
}
In for loop you can add you limit and if the limit exceed you can stop scanning.
As of iOS 13 Apple doesn't currently support limiting the scan count.
See VNDocumentCameraViewController for the documentation for the class. The delegate VNDocumentCameraViewControllerDelegate doesn't have anything either.
If you want to use the native scanner your best bet is just picking the first scan once
documentCameraViewController(_:didFinishWith:)
is called.Alternatively, you can have a look at WeScan.