I had this in Swift 2.x
let data1 = UIImagePNGRepresentation(self)!
let data2 = UIImagePNGRepresentation(image)!
return data1.isEqualToData(data2)
But now Xcode 8 - Swift 3 tells me:
Value of type 'Data' has no member 'isEqualToData'
I also tried using data1.isEqual(to: data2)
but it doesn't change much.
This is Swift, not objective C. In Swift if a type conforms to the Equatable protocol (and Data is Equatable), then you use operator == to compare two instances and not .isEqaul:
return data1 == data2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With