yannickl/QRCodeReader.swift

In iPad, the QR code reader returns result before we can see the QR code in camera

Closed this issue · 2 comments

It returns result before we can see the QR code in the camera

I noticed the camera has wider angle and managed to capture the QR code before the QR code reaches the camera UI, since the camera UI is way smaller in iPad, as shown below
simulator screen shot - ipad pro 12 9-inch 3rd generation - 2018-11-07 at 09 52 02

Is there any way we can return result only when the QR code is within the white dotted boundary?

I got the same issue!

I've added the feature for the next version. You'll be able to configure the scan area via the QRCodeReaderViewControllerBuilder:

let builder = QRCodeReaderViewControllerBuilder {
  $0.reader         = QRCodeReader(metadataObjectTypes: [.qr], captureDevicePosition: .back)
  $0.rectOfInterest = CGRect(x: 0.15, y: 0.15, width: 0.7, height: 0.7)
}

It follows the same API of the AVCaptureMetadataOut's rectOfInterest: https://developer.apple.com/documentation/avfoundation/avcapturemetadataoutput/1616291-rectofinterest

Now see the #106 thread please.