I made an IOS app that using OCR to scan barcodes and copies the data to UserDefaults.standard.value(forKey: \"barcodeId\") as! String from a receipt. I\'m trying to auto-popula
when you barcode scan completed then there are mainly two data arrived one is type of barcode and second one is data that you scanned. Make sure when you are going to paste it it is valid string data, then write following code to copy that barcode data
UIPasteboard.general.string = barcodeData
.
Then on the pasting of this data, write following code:
if let barcodeData = UIPasteboard.general.string { your code here }