Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftmetatype and runtime metadataSingle-choice MCQ

What is the difference between type(of: x) and X.self, and what does each actually return at runtime when X is a class with subclasses?

class Base {} class Derived: Base {} let b: Base = Derived() print(type(of: b) == Base.self)