Swift arrays and contains, how to determine if a collection contains an object or value?

Swift 1:

let array = ["1", "2", "3"]
let contained = contains(array, "2")
println(contained ? "yes" : "no")

Swift 2, 3, 4:

let array = ["1", "2", "3"]
let contained = array.contains("2")
print(contained ? "yes" : "no")

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)