A method that supports cutting, copying, and dragging tokens from a search field.


protocol UISearchTextFieldDelegate


A search field asks its delegate for an NSItemProvider when the user starts to copy or move a token. To support these interactions, set the search field's delegate to an instance of UISearchTextFieldDelegate that implements searchTextField(_:itemProviderForCopying:) and set the search field's allowsCopyingTokens property to true.

The search field’s pasteDelegate handles pasting and dropping tokens as well as text.


Providing Information to Copy and Drag

func searchTextField(UISearchTextField, itemProviderForCopying: UISearchToken) -> NSItemProvider

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


Inherits From

See Also

Text Views

class UILabel

A view that displays one or more lines of informational text.

class UITextField

An object that displays an editable text area in your interface.

class UITextView

A scrollable, multiline text region.

class UISearchTextField

A view for displaying and editing text and search tokens.

class UISearchToken

Search criteria in a search text field, represented by text and an optional icon.

Drag and Drop Customization

Extend the standard drag and drop support for text views to include custom types of content.