<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextField/textShouldBeginEditing(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextField(im)textShouldBeginEditing:"
  },
  "title" : "textShouldBeginEditing(_:)"
}
-->

# textShouldBeginEditing(_:)

Requests permission to begin editing a text object.

```
func textShouldBeginEditing(_ textObject: NSText) -> Bool
```

## Parameters

`textObject`

The  object to begin editing.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if editing can begin; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

If the text field isn’t editable, this method returns <doc://com.apple.documentation/documentation/Swift/false> immediately. If the text field is editable and its delegate responds to [`control(_:textShouldBeginEditing:)`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textShouldBeginEditing:)), this method invokes that method and returns the result. Otherwise, it returns <doc://com.apple.documentation/documentation/Swift/true> to allow editing to occur. See [`NSControl`](/documentation/AppKit/NSControl) for more information about the text delegate method.

---

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)