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

Why does the `mutating` keyword matter when a protocol method is implemented in a protocol extension and called on a value type?

protocol Counter { var count: Int { get set } } extension Counter { mutating func bump() { count += 1 } } struct C: Counter { var count = 0 } var c = C() c.bump() print(c.count)