Mutability
Many of the classes in the Foundation framework are immutable meaning that instances are created with a particular value or content, and the value does not change for the life of the instance. If another value is needed or different information must be stored, a new instance is created with the new value rather than changing the value of an existing instance. The value stored by an immutable object never changes after the object is initialized.
In contrast to immutable objects, the value or content of mutable objects can be changed any number of times. In most cases, when the Foundation framework includes an immutable class, a mutable variant is also available. Mutable classes are commonly implemented as subclasses of immutable ones. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access