twostraws / CodeScanner

A SwiftUI view that is able to scan barcodes, QR codes, and more, and send back what was found.
MIT License
1.02k stars 293 forks source link

Zoom Method, Tap to Focus, Barcode Type, Pause, White Flash (see my Fork) #25

Closed xremix closed 2 years ago

xremix commented 3 years ago

Hi @twostraws ,

thanks one more time for this awesome lib! I'd have some ideas for useful improvements that I implemented on my Fork that I could work out and open PRs. I'd appreciate any feedback and could work on those, if you or someone else finds them useful.

Zoom Method Having the option to zoom the camera view could be very benefitial. I implemented this by providing a zoom function: Zoom Function in my Fork

Tap to Focus By listening on touches began we can detect where the user touched and focus on that area in the camera. See my fork again

Additionally using . continuousAutoFocus would make the camera adjust the AF. Currently I have the feeling it's kinda stuck sometimes.

Pass a Result Object Instead of passing the success / failure in the method we could pass a full object with some more meta data that we could extend in the future. For example I'd like to get the type of barcode (was it QR or EAN?) in the success method. This would be my suggestion of such an object.

White Flash when success In my App I implemented a white flash overlay that animates when a barcode was recognized. I found it more useful to have this option under my control, but I can build a pull request with an overlay if that's wanted.

Pause scanning An option to pause the trigger of the success events might be helpful, if the App has some modal or so and shouldn't continue scanning.

Like I said before, I'm willing to spend some time on any of these features as I implemented all of them in my Fork or in my App. If you like them let me know and I'll contribute a PR.

LuckeyLogic commented 3 years ago

Hello,

I am new to GitHub so forgive me if this comment is out of place. I have possible contributions as well as some requests.

I recently started to work with this code and have implemented a nice way to scan multiple codes (each returning what I have named a QRPacket) which display translucent icons at the bottom of the scanner view. This allows for navigation upon the tap of an icon and will persist all scanned objects until the scanner is dismissed. I am also working on an indicator overlay that will highlight or outline currently found codes in the view (as opposed to the current output of no haptic feedback or indication that a code was successfully read. My project would require scanning several codes in the view at a time and I do not like not knowing if there is an error scanning or I have already scanned a particular code) I don’t know how to or who to share these with but would love to contribute if anyone is interested.

What I need help with though is how to remove items from the codesFound Set without dismissing or re-initializing the view.

Thank you.

xremix commented 3 years ago

Hi @LuckeyTech welcome at the GitHub family!

I think you had a great idea in pitching your idea and asking for contribution at an / this existing community of the same topic. However I'm not sure if this repo or this issue is the best place for your ideas.

If your ideas are about to extend this CodeScanner, I'd go ahead, make a fork of this repo and start implementing your changes. Once you got some contributions that you can share and that are ready you could open a pull request to merge your changes to this repository. The repository owner could give you feedback and let you know if he likes your changes or not, or if they are out of scope (which I somehow guess from what I got). If they are independent, I'd create a new Repository (which could make use of CodeScanner) and hope for contributions there with the parts where you need help. This will be challenging anyways.

However, I think this issue is not the right place, I think.

winsmith commented 3 years ago

Hi @xremix -- It seems like TwoStraws is not reacting to this*, so I'm including your fork in my project for now. Thanks for creating it! I'll see if I can make some contributions and comments along the line. Thanks for taking the time to do this :)

Would you consider adding releases to your fork? Right now I just set the version to "main branch", and it would be cool to set it to a version number instead.

** I'm not judging btw. Maintaining open source projects is hard and stressful and Paul is, like, SUPER busy doing stuff for the community.

twostraws commented 3 years ago

If you want the PR merged, read the code through then approve the PR here on GitHub – it saves me a huge amount of work, and makes it much more likely they get merged in directly.

winsmith commented 3 years ago

Aah even better. Didn't know that was the process with this project!