Closed oefterdal closed 1 year ago
I have to kill the app between scans, if I Dismiss the sheet and try to perform a new scan it won't scan.
var body: some View { ZStack { Rectangle() .fill(Color.white) .frame(width: 300, height: 100) .cornerRadius(20) .overlay( CodeScannerView(codeTypes: [.ean8, .ean13], showViewfinder: true) { result in switch result { case .success(let code): self.scannedResult = code.string self.checkResult(result: self.scannedResult!) self.showResult = true case .failure(let error): print(error.localizedDescription) } }) .sheet(isPresented: $showResult) { ResultView(scannedResult: self.$scannedResult, showResult: self.$showResult) } } } } struct ResultView: View { @Binding var scannedResult: String? @Binding var showResult: Bool var body: some View { VStack { Text("Scanned Result") .font(.headline) if let result = scannedResult { Text(result) .font(.body) } else { Text("No result found") .font(.body) } Button("Dismiss") { self.scannedResult = nil self.showResult = false } } .padding() } }
Duplicate of #98
I have to kill the app between scans, if I Dismiss the sheet and try to perform a new scan it won't scan.