detectValues(for:inItemSet:completionHandler:)
Requests that the data detection system identify the types of data that you specify for the pasteboard items, and provide the values that it matches to your closure.
Declaration
func detectValues(for keyPaths: Set<PartialKeyPath<UIPasteboard.DetectedValues>>, inItemSet itemSet: IndexSet?, 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.
- itemSet:
A set of indexes you provide to indicate which pasteboard items the data detection system inspects to detect values.
- completionHandler:
A closure you provide to process values the data detection system matches, or to handle errors.
Discussion
Because this method gives the app access to the values it detects in a pasteboard item, the system notifies the user about reading the contents of the pasteboard.