I have a protocol and a class that extends that protocol
public protocol P {
}
public class C: P {
}
print(C.self is P.Protocol)
Please why do I get Cast from 'C.Type' to unrelated type 'P.Protocol' always fails when printing?
I have a protocol and a class that extends that protocol
public protocol P {
}
public class C: P {
}
print(C.self is P.Protocol)
Please why do I get Cast from 'C.Type' to unrelated type 'P.Protocol' always fails when printing?
The check for is will work when you do it for an instance of type C, i.e.
let c = C()
print(c is P) //true