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

Reset the ScannerController on viewWillAppear #38

Closed jorgenpt closed 3 years ago

jorgenpt commented 3 years ago

When the CodeScannerView is used in a navigation stack, if you navigate back to it it will no longer scan any codes (because isFinishedScanning is true). This changes it so that we reset the state of the ScannerController when the view apepars, so that it's ready to be reused.

twostraws commented 3 years ago

Thank you!

thegodfather001 commented 2 years ago

It seems like adding a .navigationViewStyle(StackNaviagtionViewStyle()) onto a NavigationView breaks this fix. I'm trying to add this so an iPad doesn't go into split screen for the menu.