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

# xpc_array_apply(_:_:)

Invokes the specified block for every value in the array.

```
func xpc_array_apply(_ xarray: xpc_object_t, _ applier: (Int, xpc_object_t) -> Bool) -> Bool
```

## Parameters

`xarray`

The array object which is to be examined.

`applier`

The block which this function applies to every element in the array.

## Return Value

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

## Discussion

You should not modify an array’s contents during iteration. The array indexes are iterated in order.

---

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)