I know how to get an instance of a metatype...
let t = type(of: obj) // or...
let t = SomeType.self
But is there a way to check another instance obj2
to see if it is assignable to that type t
? I can say t == type(of: obj2)
but that doesn't account for subclasses and protocols.
Rob