I have two Array
holding the instances of class MYItems
. FavoriteItems
holds the favorite items from the array Items
var Items :[MYItems] = []
var favoriteItems = [MYItems]()
Now i want to check if the Items array contains the favoriteItems in the . How can i acheive this? i tried using the below Find method
if let index = find(favoriteItems, Items[indexPath.row]){
println("found item")
}else{
println("doesnotcontains item")
}
I tried using the below but that doesnot help too..
if contains(favoriteItems, Items[indexPath.row]){
println("found item")
}else{
println("doesnot contain item")
}
But it always goes to the else block? Why is this happening when i contain one of the items in array for sure.