Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftprotocol witness tablesSingle-choice MCQ

Consider a protocol `P` with an extension method that is NOT a protocol requirement (declared only in the extension, not in the protocol body). What determines which implementation runs when called through `any P`, and why?

protocol P {} extension P { func describe() -> String { "P" } } struct S: P { func describe() -> String { "S" } } let x: any P = S() print(x.describe())