I have the following code:
import RealmSwift
class MyClass:Object{
}
func test(){
let set = Set<MyClass>()
}
I get a compile time error: Type 'MyClass' does not conform to protocol 'Hashable' on this line:
let set = Set<MyClass>()
MyClass extends Realm's class Object, which extends RLMObjectBase, which extends NSObject. NSObject conforms to Hashable. It is declared in an extension.
Why doesn't MyClass confrom to Hashable since one of its superclasses conforms to it?
Furthermore, if I add Hashable like this:
class MyClass:Object, Hashable
then the error disappears, but another colegue of mine, who works on the same project, gets a compile time error:
redundant protocol conformance
This error means that a subclass declares conformance to a protocol which is already inherited from a superclass.
Does anyone understand what is going on here?