Provide a new mode for detecting when a code is visible

Open
#155 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
swift
Domain
mobile

Research direction

Start by reviewing the existing continuous scanning mode and the ScanResult and ScanError types mentioned in the issue. Trace when the completion handler runs and determine how a visibility-specific mode could report both detected and absent codes; done means the behavior supports the described QR-code button experience and preserves the existing scan modes.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Swift
Stars
1.2k
Forks
328
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from twostraws/CodeScanner

All issues in twostraws/CodeScanner

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.