The NSMutable​Copying protocol declares a method for providing mutable copies of an object. Only classes that define an “immutable vs. mutable” distinction should adopt this protocol. Classes that don’t define such a distinction should adopt NSCopying instead.


NSMutable​Copying declares one method, mutable​Copy(with:​), but mutable copying is commonly invoked with the convenience method mutable​Copy(). The mutable​Copy() method is defined for all NSObjects and simply invokes mutable​Copy(with:​) with the default zone.

If a subclass inherits NSMutable​Copying from its superclass and declares additional instance variables, the subclass has to override mutable​Copy(with:​) to properly handle its own instance variables, invoking the superclass’s implementation first.



func mutable​Copy(with:​ NSZone? = nil)

Returns a new instance that’s a mutable copy of the receiver.