<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObject-swift.class/willChangeValue(forKey:withSetMutation:using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Objective-C Runtime",
      "ObjectiveC"
    ],
    "preciseIdentifier" : "c:objc(cs)NSObject(im)willChangeValueForKey:withSetMutation:usingObjects:"
  },
  "title" : "willChangeValue(forKey:withSetMutation:using:)"
}
-->

# willChangeValue(forKey:withSetMutation:using:)

Informs the observed object that the specified change is about to be made to a specified unordered to-many relationship.

```
func willChangeValue(forKey key: String, withSetMutation mutationKind: NSKeyValueSetMutationKind, using objects: Set<AnyHashable>)
```

## Parameters

`key`

The name of a property that is an unordered to-many relationship

`mutationKind`

The type of change that will be made.

`objects`

The objects that are involved in the change (see <doc://com.apple.documentation/documentation/Foundation/NSKeyValueSetMutationKind>).

## Discussion

Use this method when implementing key-value observer compliance manually.

> Important:
> After the values have been changed, a corresponding ``doc://com.apple.objectivec/documentation/ObjectiveC/NSObject-swift.class/didChangeValue(forKey:withSetMutation:using:)`` 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`.

---

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)