<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.5.0"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObject-swift.class/setKeys:triggerChangeNotificationsForDependentKey:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:objc(cs)NSObject(cm)setKeys:triggerChangeNotificationsForDependentKey:"
  },
  "title" : "setKeys:triggerChangeNotificationsForDependentKey:"
}
-->

# setKeys:triggerChangeNotificationsForDependentKey:

Configures the observed object to post change notifications for a given property if any of the properties specified in a given array changes.

```
+ (void) setKeys:(NSArray *) keys triggerChangeNotificationsForDependentKey:(NSString *) dependentKey;
```

## Parameters

`keys`

The names of the properties upon which the value of the property identified by `dependentKey` depends.

`dependentKey`

The name of a property whose value depends on the properties specified by `keys`.

## Discussion

Invocations of will- and did-change KVO notification methods for any key in `keys` automatically invokes the corresponding change notification methods for `dependentKey`. The observed object does not receive `willChange` or `didChange` messages to generate the notifications.

Dependencies should be registered before any instances of the receiving class are created, so you typically invoke this method in a class’s [`initialize()`](/documentation/ObjectiveC/NSObject-swift.class/initialize()) method, as illustrated in the following example.

```objc
+ (void)initialize {
    [self setKeys:@[@"firstName", @"lastName"] triggerChangeNotificationsForDependentKey:@"fullName"];
}
```

---

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)