mercredi 30 août 2017

How to get a expected result by comparing array using a specific value

I'm trying to print the result by using a condition

let say I have a class that contain 1 set of array

let array1 = ["0001", "0002", "0003"]

and I have another class that contain struct return an "Int" to call the string inside array

Struct {
value1: Int
value2: Int
}

and in viewController I want to give it a condition to print only the specific string ie. only print if 0001, 0003 is detected

func printValue() {

if someclasss.value1 == ["0001", "0003"] {
print(value1, value2)
    }
}

but every time i try to check it return error on if condition line ,is there any suggestion ?

Aucun commentaire:

Enregistrer un commentaire