<!--
{
  "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_dictionary_set_connection(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "XPC"
    ],
    "preciseIdentifier" : "c:@F@xpc_dictionary_set_connection"
  },
  "title" : "xpc_dictionary_set_connection(_:_:_:)"
}
-->

# xpc_dictionary_set_connection(_:_:_:)

Inserts a connection into a dictionary.

```
func xpc_dictionary_set_connection(_ xdict: xpc_object_t, _ key: UnsafePointer<CChar>, _ connection: xpc_connection_t)
```

## Parameters

`xdict`

The dictionary which is to be manipulated.

`key`

The key for which the primitive value shall be set.

`connection`

The connection to insert. After calling this method, the XPC object corresponding to the primitive value inserted may be safely retrieved with [`xpc_dictionary_get_value(_:_:)`](/documentation/XPC/xpc_dictionary_get_value(_:_:)). The connection is NOT retained by the dictionary.

## Discussion

---

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)