<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "JavaScriptCore",
  "identifier" : "/documentation/JavaScriptCore/JSObjectGetPropertyNamesCallback",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:@T@JSObjectGetPropertyNamesCallback"
  },
  "title" : "JSObjectGetPropertyNamesCallback"
}
-->

# JSObjectGetPropertyNamesCallback

The callback type for collecting the names of an object’s properties.

```
typealias JSObjectGetPropertyNamesCallback = (JSContextRef?, JSObjectRef?, JSPropertyNameAccumulatorRef?) -> Void
```

## Parameters

`ctx`

The execution context to use.

`object`

The [`JSObjectRef`](/documentation/JavaScriptCore/JSObjectRef) with the property names to collect.

`accumulator`

A JavaScript property name accumulator to accumulate the names of the object’s properties in.

## Discussion

If you name your function `GetPropertyNames`, you declare it like this:

```c
void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames);
```

[`JSObjectCopyPropertyNames(_:_:)`](/documentation/JavaScriptCore/JSObjectCopyPropertyNames(_:_:)) and JavaScript `for-in` loops use property name accumulators.

Use [`JSPropertyNameAccumulatorAddName(_:_:)`](/documentation/JavaScriptCore/JSPropertyNameAccumulatorAddName(_:_:)) to add property names to `accumulator`. A class’s [`getPropertyNames`](/documentation/JavaScriptCore/JSClassDefinition/getPropertyNames) callback only needs to provide the names of properties that the class vends through a custom [`getProperty`](/documentation/JavaScriptCore/JSClassDefinition/getProperty) or [`setProperty`](/documentation/JavaScriptCore/JSClassDefinition/setProperty) callback. The system adds other properties independently, including statically declared properties, properties that other classes vend, and properties that belong to the object’s prototype.

---

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)