CodeScanner icon indicating copy to clipboard operation
CodeScanner copied to clipboard

Provide a new mode for detecting when a code is visible

Open alobaili opened this issue 1 year ago • 1 comments

There should be a new scanning mode where the camera is actively detecting the existence of a code. This new mode should behave similar to how you scan a code in the built-in Camera app.

If the code is visible, complete with the ScanResult. If the code is not visible, complete with nil or a ScanError.notVisible or something like that.

Context

I'm trying to implement an experience where a button is only visible when a QR code is visible and detected, and hide the button when there is no QR codes visible. this button then runs some logic with the QR code's string value.

Alternatives Tried

I tried using the continuous mode but it only triggers the completion block when a QR code is detected, but it does not tell me if no QR codes are visible yet.

I also tried to use a String? state variable and assign it to nil at the end of the completion block after a delay that is greater than or equal to the scanInterval, but this results in my custom button flickering and doesn't animate well.

alobaili avatar Dec 10 '24 14:12 alobaili

After a more in depth research I discovered DataScannerViewController, it might be a good direction for this library to consider using DataScannerViewController under the hood to enable more capabilities and use cases like this issue.

alobaili avatar Dec 10 '24 15:12 alobaili