You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good morning, I want to preface by saying that I'm not an experienced Swift and iOS programmer, but I think I've found a bug with the flashlight.
I've implemented the QR code reading library and added a button to toggle the flashlight on and off. However, when I activate the flashlight, the QR code reading screen freezes.
// QR Code part
CodeScannerView(
codeTypes: [.qr],
simulatedData: "result",
completion: { result in
switch result {
case .success(let result):
self.ticketScan.handleEvent(event: .OnCodeFound(ticket: result.string))
break
case .failure(let error):
self.ticketScan.handleEvent(event: .OnError(.QRCodeScan))
}
}
)
//Toggle Flash
private func toggleFlash() {
guard let device = AVCaptureDevice.default(for: .video) else { return }
if device.hasTorch {
do {
try device.lockForConfiguration()
if device.torchMode == .on {
device.torchMode = .off
} else {
device.torchMode = .on
}
device.unlockForConfiguration()
} catch {
self.ticketScan.handleEvent(event: .OnError(.NoCamera))
}
} else {
self.ticketScan.handleEvent(event: .OnError(.NoFlash))
}
}
Thank you very much for the time you've dedicated to me.
The text was updated successfully, but these errors were encountered:
I think the QR code reading screen freezes because your code takes control of the Camere Hardware, and the CodeScannerView loses the Camera control, so CodeScannerView freezes.
The Flashlight capability is implemented in CodeScannerView. Try this:
Good morning, I want to preface by saying that I'm not an experienced Swift and iOS programmer, but I think I've found a bug with the flashlight.
I've implemented the QR code reading library and added a button to toggle the flashlight on and off. However, when I activate the flashlight, the QR code reading screen freezes.
Thank you very much for the time you've dedicated to me.
The text was updated successfully, but these errors were encountered: