how to remove common elements from one array by comparing it with another array

Viewed 2462

I have a class

class CardImage {
var imageName: String?
var image : UIImage?
var is_saved = false
}

I have two arrays

var imagesToBeDeleted = [String]()
var cardImages = [CardImage]()

I want to delete elements from cardImages that has property imageName similar to the elements present in imagesToBeDeleted.

EXTRA DETAIL: from the names of both arrays you can figure out that imagesToBeDeleted will be subset of imageName property of cardImages array.

1 Answers
Related