<!--
{
  "availability" : [
    "iOS: 1.0.0 -",
    "iPadOS: 1.0.0 -",
    "macCatalyst: 1.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 1.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCopying/copy(with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSCopying(im)copyWithZone:"
  },
  "title" : "copy(with:)"
}
-->

# copy(with:)

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

```
func copy(with zone: NSZone? = nil) -> Any
```

## Parameters

`zone`

This parameter is ignored. Memory zones are no longer used by Objective-C.

## Discussion

The returned object is implicitly retained by the sender, who is responsible for releasing it. The copy returned is immutable if the consideration “immutable vs. mutable” applies to the receiving object; otherwise the exact nature of the copy is determined by the class.

## See Also

[`mutableCopy(with:)`](/documentation/Foundation/NSMutableCopying/mutableCopy(with:))

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

  <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/copy()>

  [Advanced Memory Management Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemoryMgmt.html#//apple_ref/doc/uid/10000011i)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)