/// Returns the swap link from a Swap Code read from an UIImage. Will return "" if none is found.
func swapCodeLinkFrom(Image image: UIImage) -> String {
var swapLink = ""
var detector = CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh])
if let detector = detector{
if let ciimage = CIImage(image: image){
var features = detector.features(in: ciimage)
for feature in features{
let decodedCode = (feature as! CIQRCodeFeature).messageString
swapLink = decodedCode ?? ""
}
}
}
return swapLink
}