<!--
{
  "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/JSObjectSetPropertyCallback",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:@T@JSObjectSetPropertyCallback"
  },
  "title" : "JSObjectSetPropertyCallback"
}
-->

# JSObjectSetPropertyCallback

The callback type for setting a property’s value.

```
typealias JSObjectSetPropertyCallback = (JSContextRef?, JSObjectRef?, JSStringRef?, JSValueRef?, UnsafeMutablePointer<JSValueRef?>?) -> Bool
```

## Parameters

`ctx`

The execution context to use.

`object`

The [`JSObjectRef`](/documentation/JavaScriptCore/JSObjectRef) to set the property’s value on.

`propertyName`

A [`JSStringRef`](/documentation/JavaScriptCore/JSStringRef) that contains the name of the property to set.

`value`

A [`JSValueRef`](/documentation/JavaScriptCore/JSValueRef) to use as the property’s value.

`exception`

A pointer to a [`JSValueRef`](/documentation/JavaScriptCore/JSValueRef) to return an exception in, if any.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if setting the property succeeds; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

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

```c
bool SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
```

If this function returns false, the set request forwards to the object’s statically declared properties, and then its parent class chain (which includes the default object class).

---

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)