Apple Developer Documentation

A protocol that objects adopt to provide functional copies of themselves.

Declaration

protocol NSCopying

Overview

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. A copy produced with NSCopying is implicitly retained by the sender, who is responsible for releasing it.

copy의 정확한 의미는 클래스마다 다를 수있지만 복사본은 복사본이 만들어질 당시의 원본과 동일한 값을 가진 기능적으로 독립적인 객체여야 한다. NSCopying으로 생성된 사본은 이를 배포할 책임이 있는 발신자가 암시적으로 보유하고 있다.


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 default zone.

NSCopying은 하나의 메서드 copy(with:)를 선언하지만 일반적으로 편리한 메서드인 copy()를 호출한다. copy()메서드는 NSObject를 상속하는 모든 객체에 대해 정의되며 기본 영역으로 copy(with: )를 호출하기만 하면 된다.


Your options for implementing this protocol are as follows: