I have a problem to retrieve and display all the information about the QR Code in Swift 4.
I used a QR Code generator with text extension in which I added
{"number":"+33688888888","amount":"50"}
in my function to call and display information
func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection)
{
if metadataObjects != nil && metadataObjects.count != 0
{
let metadataObj = metadataObjects[0] as! AVMetadataMachineReadableCodeObject
if metadataObj.type == AVMetadataObject.ObjectType.qr
{
let info = HPPayMoneySuccessModel(titlePage: "Payment", imageInfo: "confirm_checked2", titleDescription: "Congratulations your transaction has been successfully completed", numberString: metadataObj.stringValue!, amountString: metadataObj.stringValue!, buttonTerminate: "OK")
let segueViewController = HPPayMoneySuccessViewController.init(nibName: "HPPayMoneySuccessViewController", bundle: nil, payMoneySuccessViewModel: info)
self.navigationController?.pushViewController(segueViewController, animated: true)
self.session.stopRunning()
}
}
}
He gets me the information as a string like {"number":"+33688888888","amount":"50"}
but I just want +33688888888
in numberString
and 50
in amountString
Please help me.