Skip to content

Provide a new mode for detecting when a code is visible #155

@alobaili

Description

@alobaili

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions