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

# textFieldShouldBeginEditing(_:)

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

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

## Parameters

`textField`

The text field in which editing is about to begin.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if editing should begin or <doc://com.apple.documentation/documentation/Swift/false> if it should not.

## 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 <doc://com.apple.documentation/documentation/Swift/true> to allow editing to proceed.

If you do not implement this method, the text field acts as if this method had returned <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)