---
title: "willChange(_:valuesAt:forKey:)"
framework: objectivec
role: symbol
role_heading: Instance Method
path: "objectivec/nsobject-swift.class/willchange(_:valuesat:forkey:)"
---

# willChange(_:valuesAt:forKey:)

Informs the observed object that the specified change is about to be executed at given indexes for a specified ordered to-many relationship.

## Declaration

```swift
func willChange(_ changeKind: NSKeyValueChange, valuesAt indexes: IndexSet, forKey key: String)
```

## Parameters

- `changeKind`: The type of change that is about to be made.
- `indexes`: The indexes of the to-many relationship that will be affected by the change.
- `key`: The name of a property that is an ordered to-many relationship.

## Discussion

Discussion Use this method when implementing key-value-observing compliance manually. important: After the values have been changed, a corresponding didChange(_:valuesAt:forKey:) must be invoked with the same parameters. Special Considerations You rarely need to override this method in subclasses, but if you do, be sure to call super.

## See Also

### Notifying Observers of Changes

- [willChangeValue(forKey:)](objectivec/nsobject-swift.class/willchangevalue(forkey:).md)
- [didChangeValue(forKey:)](objectivec/nsobject-swift.class/didchangevalue(forkey:).md)
- [didChange(_:valuesAt:forKey:)](objectivec/nsobject-swift.class/didchange(_:valuesat:forkey:).md)
- [willChangeValue(forKey:withSetMutation:using:)](objectivec/nsobject-swift.class/willchangevalue(forkey:withsetmutation:using:).md)
- [didChangeValue(forKey:withSetMutation:using:)](objectivec/nsobject-swift.class/didchangevalue(forkey:withsetmutation:using:).md)
