---
title: "setValue(_:forKey:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsorderedset/setvalue(_:forkey:)"
---

# setValue(_:forKey:)

Invokes setValue:forKey: on each of the receiver’s members using the specified value and key

## Declaration

```swift
func setValue(_ value: Any?, forKey key: String)
```

## Parameters

- `value`: The object value.
- `key`: The key to store the value.

## See Also

### Key-Value Coding Support

- [value(forKey:)](foundation/nsorderedset/value(forkey:).md)
