---
title: "CFDictionaryGetValue(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfdictionarygetvalue(_:_:)"
---

# CFDictionaryGetValue(_:_:)

Returns the value associated with a given key.

## Declaration

```swift
func CFDictionaryGetValue(_ theDict: CFDictionary!, _ key: UnsafeRawPointer!) -> UnsafeRawPointer!
```

## Parameters

- `theDict`: The dictionary to examine.
- `key`: The key for which to find a match in theDict. The key hash and equal callbacks provided when the dictionary was created are used to compare. If the hash callback was NULL, the key is treated as a pointer and converted to an integer. If the equal callback was NULL, pointer equality (in C, ==) is used. If key, or any of the keys in theDict, is not understood by the equal callback, the behavior is undefined.

## Return Value

Return Value The value associated with key in theDict, or NULL if no key-value pair matching key exists. Since NULL is also a valid value in some dictionaries, use CFDictionaryGetValueIfPresent(_:_:_:) to distinguish between a value that is not found, and a NULL value. If the value is a Core Foundation object, ownership follows the The Get Rule.

## See Also

### Examining a dictionary

- [CFDictionaryContainsKey(_:_:)](corefoundation/cfdictionarycontainskey(_:_:).md)
- [CFDictionaryContainsValue(_:_:)](corefoundation/cfdictionarycontainsvalue(_:_:).md)
- [CFDictionaryGetCount(_:)](corefoundation/cfdictionarygetcount(_:).md)
- [CFDictionaryGetCountOfKey(_:_:)](corefoundation/cfdictionarygetcountofkey(_:_:).md)
- [CFDictionaryGetCountOfValue(_:_:)](corefoundation/cfdictionarygetcountofvalue(_:_:).md)
- [CFDictionaryGetKeysAndValues(_:_:_:)](corefoundation/cfdictionarygetkeysandvalues(_:_:_:).md)
- [CFDictionaryGetValueIfPresent(_:_:_:)](corefoundation/cfdictionarygetvalueifpresent(_:_:_:).md)
