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

# xpc_data_create_with_dispatch_data(_:)

Creates an XPC object that represents a buffer of bytes that the specified GCD data object describes.

## Declaration

```swift
func xpc_data_create_with_dispatch_data(_ ddata: dispatch_data_t) -> xpc_object_t
```

## Parameters

- `ddata`: The GCD data object containing the bytes which are to be boxed. This object is retained by the data object.

## Return Value

Return Value A new data object.

## Discussion

Discussion The object returned by this method will refer to the buffer returned by dispatch_data_create_map. The point where XPC will make the call to dispatch_data_create_map is undefined.

## See Also

### Data objects

- [xpc_data_create(_:_:)](xpc/xpc_data_create(_:_:).md)
- [xpc_data_get_bytes(_:_:_:_:)](xpc/xpc_data_get_bytes(_:_:_:_:).md)
- [xpc_data_get_bytes_ptr(_:)](xpc/xpc_data_get_bytes_ptr(_:).md)
- [xpc_data_get_length(_:)](xpc/xpc_data_get_length(_:).md)
