---
title: "willChangeValue(forKey:)"
framework: objectivec
role: symbol
role_heading: Instance Method
path: "objectivec/nsobject-swift.class/willchangevalue(forkey:)"
---

# willChangeValue(forKey:)

Informs the observed object that the value of a given property is about to change.

## Declaration

```swift
func willChangeValue(forKey key: String)
```

## Parameters

- `key`: The name of the property that will change.

## Discussion

Discussion Use this method when implementing key-value observer compliance manually to inform the observed object that the value at key is about to change. The change type of this method is NSKeyValueChangeSetting. important: After the values have been changed, a corresponding didChangeValue(forKey:) must be invoked with the same parameter. 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

- [didChangeValue(forKey:)](objectivec/nsobject-swift.class/didchangevalue(forkey:).md)
- [willChange(_:valuesAt:forKey:)](objectivec/nsobject-swift.class/willchange(_:valuesat: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)
