---
title: "setKeys:triggerChangeNotificationsForDependentKey:"
framework: objectivec
role: symbol
role_heading: Type Method
path: "objectivec/nsobject-swift.class/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.

## Declaration

```occ
+ (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

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() method, as illustrated in the following example. + (void)initialize {     [self setKeys:@[@"firstName", @"lastName"] triggerChangeNotificationsForDependentKey:@"fullName"]; }

## See Also

### Deprecated Class Methods

- [defaultPlaceholder(for:with:)](objectivec/nsobject-swift.class/defaultplaceholder(for:with:).md)
- [setDefaultPlaceholder(_:for:with:)](objectivec/nsobject-swift.class/setdefaultplaceholder(_:for:with:).md)
- [useStoredAccessor()](objectivec/nsobject-swift.class/usestoredaccessor().md)
