---
title: "CFBagGetValue(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfbaggetvalue(_:_:)"
---

# CFBagGetValue(_:_:)

Returns a requested value from a bag.

## Declaration

```swift
func CFBagGetValue(_ theBag: CFBag!, _ value: UnsafeRawPointer!) -> UnsafeRawPointer!
```

## Parameters

- `theBag`: The bag to examine.
- `value`: The value for which to find matches in theBag. The equal callback provided when theBag was created is used to compare. If the equal callback was NULL, pointer equality (in C, ==) is used. If value, or any other value in theBag, is not understood by the equal callback, the behavior is undefined.

## Return Value

Return Value A pointer to value, or NULL if value is not in theBag. If the value is a Core Foundation object, ownership follows the The Get Rule.

## Discussion

Discussion Depending on the implementation of the equal callback specified when creating theBag, the value returned may not have the same pointer equality as value.

## See Also

### Examining a Bag

- [CFBagContainsValue(_:_:)](corefoundation/cfbagcontainsvalue(_:_:).md)
- [CFBagGetCount(_:)](corefoundation/cfbaggetcount(_:).md)
- [CFBagGetCountOfValue(_:_:)](corefoundation/cfbaggetcountofvalue(_:_:).md)
- [CFBagGetValueIfPresent(_:_:_:)](corefoundation/cfbaggetvalueifpresent(_:_:_:).md)
- [CFBagGetValues(_:_:)](corefoundation/cfbaggetvalues(_:_:).md)
