# Issue with \`mutating\` methods on protocols and \`AnyObject\` conformers

**URL:** <https://forums.swift.org/t/issue-with-mutating-methods-on-protocols-and-anyobject-conformers/62842>\
**Category:** Using Swift\
**Created:** [January 29, 2023, 2:04am UTC](https://forums.swift.org/t/issue-with-mutating-methods-on-protocols-and-anyobject-conformers/62842 "2023-01-29T02:04:37Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![xwu](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@xwu](https://forums.swift.org/u/xwu)\
**Post date:** [January 29, 2023, 2:31am UTC](https://forums.swift.org/t/issue-with-mutating-methods-on-protocols-and-anyobject-conformers/62842/2 "2023-01-29T02:31:09Z")

</div>

> [@Class only protocol - why the examples are not working?](https://forums.swift.org/t/class-only-protocol-why-the-examples-are-not-working/49860/2):
>
> This is because mutating means that self can be reassigned, which is not permitted for let constants even of reference type (i.e., classes). Recall that when you modify a struct member, you modify the whole struct, but this is not the case when you modify a class member. This is a common point of confusion and is discussed at length [here](https://bugs.swift.org/browse/SR-142) and [here](https://forums.swift.org/t/proposal-intermediate-mutation-qualifier-for-protocol-functions-on-reference-types/401) and [here](https://forums.swift.org/t/protocols-mutating-and-value-vs-reference-types/2395) and [here](https://forums.swift.org/t/mutating-function-on-class-type-possible-bug/15066).

---

_[View the full topic](https://forums.swift.org/t/issue-with-mutating-methods-on-protocols-and-anyobject-conformers/62842)._
