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

# xpc_equal(_:_:)

Compares two objects for equality.

```
func xpc_equal(_ object1: xpc_object_t, _ object2: xpc_object_t) -> Bool
```

## Parameters

`object1`

The first object to compare.

`object2`

The second object to compare.

## Return Value

Returns true if the objects are equal, otherwise false. Two objects must be of the same type in order to be equal.

## Discussion

For two arrays to be equal, they must contain the same values at the same indexes. For two dictionaries to be equal, they must contain the same values for the same keys.

Two objects being equal implies that their hashes (as returned by [`xpc_hash(_:)`](/documentation/XPC/xpc_hash(_:))) are also equal.

---

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)