Clear the scanned images cache in VNDocumentCameraScan Swift

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?


let vc = VNDocumentCameraViewController()

override func 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)
            dismiss(animated: true) {
                self.getFileName(img: imgArray)

Marked the scanned images icon at the bottom left

Read more here:

Content Attribution

This content was originally published by Gnanapriya C at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: