Search code examples
swiftxcodeprotocolsequatable

Binary operator '==' cannot be applied to two 'Equatable' operands... what?


You can see in the image below that I was trying to extend the Collection protocol to include a method called removingDuplicates, which is supposed to do exactly what it says. The error that the compiler is displaying seems to directly contradict the definition of the Equatable protocol. Is this a bug or am I misunderstanding something?

enter image description here


Solution

  • Replace Element == Equatable with Element: Equatable.