I\'m at it again with swift arrays and containsObject provided by NSArray only!
I bridge the swift array to NSArray to do that contains:
extension Ar
Generally, when you want to have an array that contains a custom object or struct, and you want to work with "contains" function, your class or struct should be conformed to "Equatable" protocol and you should implement the "==" function for later comparisons...
struct booy: Equatable{
static func == (lhs: booy, rhs: booy) -> Bool {
return lhs.name == rhs.name
}
var name = "abud"
}
let booy1 = booy(name: "ali")
let booy2 = booy(name: "ghasem")
var array1 = [booy]()
array1.append(booy1)
array1.append(booy2)
let booy3 = booy(name: "ali")
if array1.contains(booy3){
print("yes") }