---
title: "setDictionary(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutabledictionary/setdictionary(_:)"
---

# setDictionary(_:)

Sets the contents of the receiving dictionary to entries in a given dictionary.

## Declaration

```swift
func setDictionary(_ otherDictionary: [AnyHashable : Any])
```

## Parameters

- `otherDictionary`: A dictionary containing the new entries.

## Discussion

Discussion All entries are removed from the receiving dictionary (with removeAllObjects()), then each entry from otherDictionary added into the receiving dictionary.

## See Also

### Adding Entries to a Mutable Dictionary

- [setObject(_:forKey:)](foundation/nsmutabledictionary/setobject(_:forkey:).md)
- [setValue(_:forKey:)](foundation/nsmutabledictionary/setvalue(_:forkey:).md)
- [addEntries(from:)](foundation/nsmutabledictionary/addentries(from:).md)
