---
title: "xpc_copy(_:)"
framework: xpc
role: symbol
role_heading: Function
path: "xpc/xpc_copy(_:)"
---

# xpc_copy(_:)

Creates a copy of the object.

## Declaration

```swift
func xpc_copy(_ object: xpc_object_t) -> xpc_object_t?
```

## Parameters

- `object`: The object to copy.

## Return Value

Return Value The new object. NULL if the object type does not support copying or if sufficient memory for the copy could not be allocated. Service objects do not support copying.

## Discussion

Discussion When called on an array or dictionary, xpc_copy(_:) will perform a deep copy. The object returned is not necessarily guaranteed to be a new object, and whether it is will depend on the implementation of the object being copied.

## See Also

### Copying

- [xpc_copy_description(_:)](xpc/xpc_copy_description(_:).md)
