NSCopying

The NSCopying protocol declares a method for providing functional copies of an object. The exact meaning of “copy” can vary from class to class, but a copy must be a functionally independent object with values identical to the original at the time the copy was made.

protocol NSCopying
Browse conforming types

NSCopying declares one method, copy(with:), but copying is commonly invoked with the convenience method copy. The copy method is defined for all objects inheriting from NSObject and simply invokes copy(with:) with the nil zone.

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