---
title: "detectValues(for:completionHandler:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uipasteboard/detectvalues(for:completionhandler:)-9p2ff"
---

# detectValues(for:completionHandler:)

Determines whether the first pasteboard item matches the specified patterns, reading the contents if it finds a match.

## Declaration

```swift
func detectValues(for patterns: Set<UIPasteboard.DetectionPattern>, completionHandler: @escaping (Result<[UIPasteboard.DetectionPattern : Any], any Error>) -> ())
```

## Parameters

- `patterns`: The patterns to detect on the pasteboard.
- `completionHandler`: A closure that the system invokes after detecting patterns on the pasteboard. The closure receives a Result instance that contains either a dictionary with the patterns found on the pasteboard or an error if detection failed. If the Result instance contains a dictionary, the keys specify the matched pattern, and the value specifies the content of the pasteboard.

## Discussion

Discussion important: Calling this method notifies the user that the app has read the contents of the pasteboard. For details about the types returned for each pattern, see UIPasteboard.DetectionPattern.

## See Also

### Deprecated

- [isPersistent](uikit/uipasteboard/ispersistent.md)
- [setPersistent(_:)](uikit/uipasteboard/setpersistent(_:).md)
- [detectPatterns(for:completionHandler:)](uikit/uipasteboard/detectpatterns(for:completionhandler:)-5zlnd.md)
- [detectPatterns(for:inItemSet:completionHandler:)](uikit/uipasteboard/detectpatterns(for:initemset:completionhandler:)-29iwn.md)
- [detectValues(for:inItemSet:completionHandler:)](uikit/uipasteboard/detectvalues(for:initemset:completionhandler:)-8y0iw.md)
