---
title: "detectValuesForPatterns:inItemSet:completionHandler:"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uipasteboard/detectvaluesforpatterns:initemset:completionhandler:"
---

# detectValuesForPatterns:inItemSet:completionHandler:

Determines whether pasteboard items match the specified patterns, reading the contents if it finds a match.

## Declaration

```occ
- (void) detectValuesForPatterns:(NSSet<NSString *> *) patterns inItemSet:(NSIndexSet *) itemSet completionHandler:(void (^)(NSArray<NSDictionary<NSString *,id> *> *, NSError *)) completionHandler;
```

## Parameters

- `patterns`: The patterns to detect on the pasteboard.
- `itemSet`: An index set with each integer value identifying a pasteboard item positionally in the pasteboard. Pass in nil to request all pasteboard items.
- `completionHandler`: A block that the system invokes after detecting patterns on the pasteboard. The block receives a Result instance that contains either an array of dictionaries with the patterns and the associated values found on the pasteboard or an error if detection failed. If Result contains an array, the index of each element in the array corresponds to the pasteboard item index specified in itemSet.

## 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

### Detecting patterns of content in pasteboard items

- [detectPatternsForPatterns:completionHandler:](uikit/uipasteboard/detectpatternsforpatterns:completionhandler:.md)
- [detectPatternsForPatterns:inItemSet:completionHandler:](uikit/uipasteboard/detectpatternsforpatterns:initemset:completionhandler:.md)
- [detectValuesForPatterns:completionHandler:](uikit/uipasteboard/detectvaluesforpatterns:completionhandler:.md)
- [UIPasteboard.DetectionPattern](uikit/uipasteboard/detectionpattern.md)
