Babylon Research
Babylon Research

Reputation: 33

Cannot load module 'visionKit' as 'VisionKit'

Im trying to build a simple app to scan documents, but faced this error when trying to import VisionKit module, how can i solve this error ? code

My code:

import UIKit 
import VisionKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }

    @IBAction func openCameraButtonTaped(_ sender: Any) {
        configureDocumentView()
    }
    
    private func configureDocumentView() {
        let scaningDocumentViewController = VNDocumentCameraViewController()
        scaningDocumentViewController.delegate = self
        self.present(scaningDocumentViewController, animated: true, completion: nil)
    }
}

extension ViewController: VNDocumentCameraViewControllerDelegate {
    func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {
        for pageNum in 0..<scan.pageCount {
            let image = scan.imageOfPage(at: pageNum)
            
            print(image)
        }
        
        controller.dismiss(animated: true, completion: nil)
    }
}

Upvotes: 0

Views: 232

Answers (1)

πter
πter

Reputation: 2217

You are giving a hard time for the compiler, your project name conflicts with Apple's VisionKit. Create a new your project with a different name.

Upvotes: 1

Related Questions