---
title: "CFSetGetValueIfPresent(_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfsetgetvalueifpresent(_:_:_:)"
---

# CFSetGetValueIfPresent(_:_:_:)

Reports whether or not a value is in a set, and if it exists returns the value indirectly.

## Declaration

```swift
func CFSetGetValueIfPresent(_ theSet: CFSet!, _ candidate: UnsafeRawPointer!, _ value: UnsafeMutablePointer<UnsafeRawPointer?>!) -> Bool
```

## Parameters

- `theSet`: The set to examine.
- `candidate`: The value for which to search in theSet. Comparisons are made using the equal callback provided when theSet was created. If the equal callback was NULL, pointer equality (in C, ==) is used.
- `value`: Upon return contains the matching value if it exists in theSet, otherwise NULL. If the value is a Core Foundation object, ownership follows the https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-SW1.

## Return Value

Return Value true if value exists in theSet, otherwise false.

## Discussion

Discussion This function uses the equal callback. candidate and all elements in the set must be understood by the equal callback. Depending on the implementation of the equal callback specified when creating theSet, the value returned in value may not have the same pointer equality as candidate.

## See Also

### Examining a Set

- [CFSetContainsValue(_:_:)](corefoundation/cfsetcontainsvalue(_:_:).md)
- [CFSetGetCount(_:)](corefoundation/cfsetgetcount(_:).md)
- [CFSetGetCountOfValue(_:_:)](corefoundation/cfsetgetcountofvalue(_:_:).md)
- [CFSetGetValue(_:_:)](corefoundation/cfsetgetvalue(_:_:).md)
- [CFSetGetValues(_:_:)](corefoundation/cfsetgetvalues(_:_:).md)
