<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XPC",
  "identifier" : "/documentation/XPC/xpc_data_create_with_dispatch_data(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "XPC"
    ],
    "preciseIdentifier" : "c:@F@xpc_data_create_with_dispatch_data"
  },
  "title" : "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.

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

A new data object.

## Discussion

The object returned by this method will refer to the buffer returned by <doc://com.apple.documentation/documentation/Dispatch/dispatch_data_create_map>. The point where XPC will make the call to <doc://com.apple.documentation/documentation/Dispatch/dispatch_data_create_map> is undefined.

---

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)