Comparing Images iOS
The isEqual: method is the only reliable way to determine whether two images contain the same image data. The image objects you create may be different from each other, even when you initialize them with the same cached image data. The only way to determine their equality is to use the isEqual: method, which compares the actual image data. Listing 1 illustrates the correct and incorrect ways to compare images.
Source: Apple Documentation
// Load the same image twice.let image1 = UIImage(named: "MyImage")
let image2 = UIImage(named…