twostraws / CodeScanner

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

Fix issue manual capture and image select buttons disappearing on load #147

Open dantasswift opened 5 months ago

dantasswift commented 5 months ago

Because updateViewController() is being called before the previewLayer is added to the view, we get an issue where the manual capture buttons disappear on load.

To fix it, we only bring the buttons to the front of the view after the previewLayer is added. Note that we only bring the buttons to front, the visibility of the buttons themselves are still begin handled in showManualCaptureButton() and showManualSelectButton() respectively.