NSCopying is a protocol that provides a way to make a copy of an object.
NSCopying
is a protocol that allows a class to make a copy of itself in whatever manner makes sense for that object. The only requirement is to implement copyWithZone:
, which typically duplicates any relevant instance variables into a new instance. Other classes can make a copy of an object by calling copy
, which is implemented by NSObject
to simply call copyWithZone:
on the receiver.