Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftprotocol-oriented programmingSingle-choice MCQ

You add a default implementation in a protocol extension constrained to a more specific conformance. Which call below dispatches to the constrained extension, and why?

protocol Shape {} protocol Drawable: Shape {} extension Shape { func render() -> String { "shape" } } extension Shape where Self: Drawable { func render() -> String { "drawable" } } struct Circle: Drawable {} let c = Circle() print(c.render())