---
title: "copy(with:device:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsfunction/copy(with:device:)"
---

# copy(with:device:)

## Declaration

```swift
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

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

Discussion Make a copy of this MPSFunction for a new device -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.
