On iOS16, I try to use the DataScannerViewController (for barcode reading) to remplace old way with Vision but when I enable the torch, DataScannerViewController is freezing...
The code to enable/disable torch :
guard let device = AVCaptureDevice.default(for: .video), device.hasTorch else { return }
do {
    try device.lockForConfiguration()
    device.torchMode = device.isTorchActive ? .off : .on
    device.unlockForConfiguration()
} catch {
    print(error)
}
(This code is working well with Vision)
Thanks a lot
 
     
    