Paste String Data from UIPastboard

前端 未结 1 1946
执念已碎
执念已碎 2021-01-29 02:36

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

相关标签:
1条回答
  • 2021-01-29 03:24

    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 }

    0 讨论(0)
提交回复
热议问题