---
title: "textFieldShouldBeginEditing(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextfielddelegate/textfieldshouldbeginediting(_:)"
---

# textFieldShouldBeginEditing(_:)

Asks the delegate whether to begin editing in the specified text field.

## Declaration

```swift
optional func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool
```

## Parameters

- `textField`: The text field in which editing is about to begin.

## Return Value

Return Value true if editing should begin or false if it should not.

## Discussion

Discussion The text field calls this method when the user performs an action that would normally initiate the editing of the text field’s text. Implement this method if you want to prevent editing from happening in some situations. For example, you could use this method to prevent the user from editing the text field’s contents more than once. Most of the time, you should return true to allow editing to proceed. If you do not implement this method, the text field acts as if this method had returned true.

## See Also

### Managing editing

- [textFieldDidBeginEditing(_:)](uikit/uitextfielddelegate/textfielddidbeginediting(_:).md)
- [textFieldShouldEndEditing(_:)](uikit/uitextfielddelegate/textfieldshouldendediting(_:).md)
- [textFieldDidEndEditing(_:reason:)](uikit/uitextfielddelegate/textfielddidendediting(_:reason:).md)
- [textFieldDidEndEditing(_:)](uikit/uitextfielddelegate/textfielddidendediting(_:).md)
- [UITextField.DidEndEditingReason](uikit/uitextfield/didendeditingreason.md)
