I have used vision kit for document scanning. I'm able to scan and save the documents, but the old scanned images are shown on the bottom left corner of the screen after coming back to this screen after dismissal. How to clear the scan array after dismissal?
Code:
let vc = VNDocumentCameraViewController()
override func viewDidLoad() {
super.viewDidLoad()
vc.delegate = self
}
//Save button action in document VC
func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {
print("Found \(scan.pageCount)")
var imgArray: Array<UIImage> = []
for i in 0 ..< scan.pageCount {
let image = scan.imageOfPage(at: i)
imgArray.append(image)
}
dismiss(animated: true) {
self.getFileName(img: imgArray)
}
}