<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIPasteboard/detectValues(for:completionHandler:)-6adre",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:So12UIPasteboardC5UIKitE12detectValues3for17completionHandleryShys14PartialKeyPathCyAbCE08DetectedD0VGG_ys6ResultOyAJs5Error_pGctF"
  },
  "title" : "detectValues(for:completionHandler:)"
}
-->

# detectValues(for:completionHandler:)

Requests that the data detection system identify the types of data that you specify for the pasteboard, and provide the values that it matches to your closure.

```
func detectValues(for keyPaths: Set<PartialKeyPath<UIPasteboard.DetectedValues>>, completionHandler: @escaping (Result<UIPasteboard.DetectedValues, any Error>) -> ())
```

## Parameters

`keyPaths`

A set of key paths you use to indicate which types of data you want the data detection system to match.

`completionHandler`

A closure you provide to process data the data detection system matches, or to handle errors.

## Discussion

Because this method gives the app access to the values it detects in the pasteboard, the system notifies the user about reading the contents of the pasteboard.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)