I have developed the following code and it's working fine:
if metadataObj.type == AVMetadataObjectTypeQRCode {
//the code...
}
Now, I would like for metadataObj.type
to be equal to an array of string like the following:
let barCodeTypes = [AVMetadataObjectTypeQRCode,
AVMetadataObjectTypeAztecCode
]
if metadataObj.type == barcodeTypes {
//The code...
}
I get the following error when I use the new code:
binary operator '==' cannot be applied to operands of type 'String!' and '[String]'
Any suggestions? Thanks in advance
You can't compare string and array of strings, but you can use contains
:
if barcodeTypes.contains(metadataObj.type)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments