---
title: copy()
framework: objectivec
role: symbol
role_heading: Instance Method
path: objectivec/nsobject-swift.class/copy()
---

# copy()

Returns the object returned by copy(with:).

## Declaration

```swift
func copy() -> Any
```

## Return Value

Return Value The object returned by the NSCopying protocol method copy(with:),.

## Discussion

Discussion This is a convenience method for classes that adopt the NSCopying protocol. An exception is raised if there is no implementation for copy(with:). NSObject does not itself support the NSCopying protocol. Subclasses must support the protocol and implement the copy(with:) method. A subclass version of the copy(with:) method should send the message to super first, to incorporate its implementation, unless the subclass descends directly from NSObject.

## See Also

### Creating, Copying, and Deallocating Objects

- [init()](objectivec/nsobject-swift.class/init().md)
- [mutableCopy()](objectivec/nsobject-swift.class/mutablecopy().md)
