<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UISearchTextFieldDelegate/searchTextField(_:itemProviderForCopying:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UISearchTextFieldDelegate(im)searchTextField:itemProviderForCopyingToken:"
  },
  "title" : "searchTextField(_:itemProviderForCopying:)"
}
-->

# searchTextField(_:itemProviderForCopying:)

Asks the delegate for an object that can provide a token when the copied token is pasted.

```
optional func searchTextField(_ searchTextField: UISearchTextField, itemProviderForCopying token: UISearchToken) -> NSItemProvider
```

## Parameters

`searchTextField`

The search field that contains the token the user is copying or dragging.

`token`

The token the user is copying or dragging.

## Return Value

An item provider that provides a token if the user pastes or drops the token.

## Discussion

To support drag and drop and the Cut and Copy commands, your delegate must implement this method and return an <doc://com.apple.documentation/documentation/Foundation/NSItemProvider> for the requested token. Your delegate can provide a plain text representation for pasting in other contexts, but should register a custom type identifier so it can recognize and reconstruct the token when pasted into the same field.

The system only calls this delegate method if either [`allowsCopyingTokens`](/documentation/UIKit/UISearchTextField/allowsCopyingTokens) or [`allowsDeletingTokens`](/documentation/UIKit/UISearchTextField/allowsDeletingTokens) is <doc://com.apple.documentation/documentation/Swift/true>.

---

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)