Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftassociated typesSingle-choice MCQ

Given a protocol with an associated type, why does the following line fail to compile, and what is the minimal correct fix?

protocol Container { associatedtype Item var items: [Item] { get } } func count(_ c: Container) -> Int { c.items.count }