Safe area issue with VNDocumentCameraViewController using UIViewControllerRepresentable

763 views Asked by At

How can I extend camera scanning view to safa area while using VNDocumentCameraViewController in UIViewControllerRepresentable?

here is the code

struct ScanDocumentView: UIViewControllerRepresentable {
    
    func makeCoordinator() -> Coordinator {
        Coordinator(recognizedText: $recognizedText, parent: self)
    }
    
    func makeUIViewController(context: Context) -> VNDocumentCameraViewController {
        let documentViewController = VNDocumentCameraViewController()
        documentViewController.delegate = context.coordinator
        return documentViewController
    }
    
    func updateUIViewController(_ uiViewController: VNDocumentCameraViewController, context: Context) {
        // nothing to do here
    }
}

and here is it's behavior where the bottom safe area is blank behavior

1

There are 1 answers

1
Carter Stevenson On

Problem solved! just add

.ignoresSafeArea()

under

ScanDocumentView()

and that's all