---
title: delegate
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uitextfield/delegate
---

# delegate

The text field’s delegate.

## Declaration

```swift
weak var delegate: (any UITextFieldDelegate)? { get set }
```

## Discussion

Discussion A text field delegate responds to editing-related messages from the text field. You can use the delegate to respond to the text entered by the user and to some special commands, such as when the user taps Return. note: If the text field is a UISearchTextField, set its delegate to an object that also conforms to the UISearchTextFieldDelegate protocol.

## See Also

### Validating and handling edits

- [UITextFieldDelegate](uikit/uitextfielddelegate.md)
