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

# xpc_dictionary_apply(_:_:)

Invokes the specified block for every key-value pair in the dictionary.

```
func xpc_dictionary_apply(_ xdict: xpc_object_t, _ applier: (UnsafePointer<CChar>, xpc_object_t) -> Bool) -> Bool
```

## Parameters

`xdict`

The dictionary object which is to be examined.

`applier`

The block which this function applies to every key/value pair in the dictionary.

## Return Value

A Boolean indicating whether iteration of the dictionary completed successfully. Iteration will only fail if the applier block returns false.

## Discussion

You should not modify a dictionary’s contents during iteration. There is no guaranteed order of iteration over dictionaries.

---

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)