Redundant conformance of 'Generic' to protocol 'Equatable' in Swift 2.2 Redundant conformance of 'Generic' to protocol 'Equatable' in Swift 2.2 swift swift

Redundant conformance of 'Generic' to protocol 'Equatable' in Swift 2.2


A class inheriting NSObject already conforms to Equatable. So declaring Object: Equatable is redundant.

However, the conformance does not mean that it has been implemented properly (NSObject just checks whether the pointers are the same). If you wish to properly implement Equatable for NSObject, just exclude the protocol conformance statement (: Equatable), but still implement the comparison method:

static func ==(lhs: Object, rhs: Object) -> Bool {   return lhs.text == rhs.text}


According to the docs, NSObject conforms to Equatable:

Conforms To
CVarArgType
CustomDebugStringConvertible
CustomStringConvertible
Equatable
Hashable
NSObjectProtocol

... therefore, like your error says, conformance to Equatable is redundant...