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

Front Camera #22

Closed ichbineinnerd0 closed 2 years ago

ichbineinnerd0 commented 3 years ago

I've looked over everything, and I can’t see a way to use the front camera. I was wondering if I have missed something, and if not, how difficult it would be to implement. I don't have a very in-depth knowledge to Swift, but I have tried to look over some possibilities of how to do it, but achieved nothing

AxelSariel commented 3 years ago

Not sure how needed is this as of now, but what I did was download the package, add it as a local package in Xcode, and edit line 170 of CodeScanner to the following:

let videoCaptureDevice = AVCaptureDevice.default(.builtInWideAngleCamera,for: .video, position: .front)

It would be nice to take this in as an argument when calling the scanner!

See more on Apple's Developer Website

nathanfallet commented 2 years ago

@ichbineinnerd0 @AxelSariel I added an argument to CodeScannerView in my Pull Request #52 regarding videoCaptureDevice