Protocol

NSMutableCopying

The NSMutableCopying 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.

Overview

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

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

Symbols

Copying

func mutableCopy(with: NSZone? = nil)
Required.

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