---
title: "CFDictionaryReplaceValue(_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfdictionaryreplacevalue(_:_:_:)"
---

# CFDictionaryReplaceValue(_:_:_:)

Replaces a value corresponding to a given key.

## Declaration

```swift
func CFDictionaryReplaceValue(_ theDict: CFMutableDictionary!, _ key: UnsafeRawPointer!, _ value: UnsafeRawPointer!)
```

## Parameters

- `theDict`: The dictionary to modify.
- `key`: The key of the value to replace in theDict. If a key which matches key is present in the dictionary, the value is changed to the value, otherwise this function does nothing (“replace if present”).
- `value`: The new value for key. The value object is retained by theDict using the retain callback provided when theDict was created, and the old value is released. value must be of the type expected by the retain and release callbacks.

## See Also

### Modifying a Dictionary

- [CFDictionaryAddValue(_:_:_:)](corefoundation/cfdictionaryaddvalue(_:_:_:).md)
- [CFDictionaryRemoveAllValues(_:)](corefoundation/cfdictionaryremoveallvalues(_:).md)
- [CFDictionaryRemoveValue(_:_:)](corefoundation/cfdictionaryremovevalue(_:_:).md)
- [CFDictionarySetValue(_:_:_:)](corefoundation/cfdictionarysetvalue(_:_:_:).md)
