<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/MPSFunction/copy(with:device:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSFunction(im)copyWithZone:device:"
  },
  "title" : "copy(with:device:)"
}
-->

# copy(with:device:)

```
func copy(with zone: NSZone? = nil, device: (any MTLDevice)?) -> Self
```

## Parameters

`zone`

The NSZone in which to allocate the object

`device`

The device for the new MPSKernel. If nil, then use
self.device.

## Return Value

a pointer to a copy of this MPSKernel. This will fail, returning
nil if the device is not supported. Devices must be
MTLFeatureSet_iOS_GPUFamily2_v1 or later.

## Discussion\abstract Make a copy of this MPSFunction for a new device
\discussion -copyWithZone: will call this API to make a copy of the
MPSKernel on the same device.  This interface may also be
called directly to make a copy of the MPSFunction on a new
device.

---

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)