I tried this piece of code:
import Foundation
protocol P: Equatable {}
class T {
var p: any P
init(_ pp: any P) {
self.p = pp
}
func update(_ pp: any P) {
if pp != p {
p = pp
}
}
}
But I'm getting an error:
Binary operator '!=' cannot be applied to two 'any P' operands
Why is that and how can I solve this? Thank you for your help