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. ...
Get Cocoa® Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.