This can be demonstrated with the use of default implementations.
protocol P {
init(value: Int)
var value: Int { get }
mutating func increment()
}
extension P {
mutating func increment() {
self = Self(value: value + 1)
}
}
final class C: P {
let value: Int
init(value: Int) {
self.value = value
}
}
do {
var x = C(value: 0)
x.increment()
x.increment()
print("C(value: \(x.value))") // prints: C(value: 2)
}
C.increment is a mutating function, even though C is a class.