binary operator '==' cannot be applied to operands of type 'String!' and '[String]' in Swift 2 Xcode 7 -


i have developed following code , it's working fine:

if metadataobj.type == avmetadataobjecttypeqrcode {     //the code... } 

now, metadataobj.type equal array of string following:

let barcodetypes = [avmetadataobjecttypeqrcode,                     avmetadataobjecttypeazteccode ]  if metadataobj.type == barcodetypes {     //the code... } 

i following error when use new code:

binary operator '==' cannot applied operands of type 'string!' , '[string]'

any suggestions? in advance

you can't compare string , array of strings, can use contains:

 if barcodetypes.contains(metadataobj.type) 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo