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

# textShouldBeginEditing(_:)

Requests permission to begin editing text.

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

## Parameters

`textObject`

The text object requesting permission to begin editing.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the text object should proceed to make changes. If the delegate returns <doc://com.apple.documentation/documentation/Swift/false>, the text object abandons the editing operation.

## Discussion

The default behavior of this method is to return the value obtained from [`control(_:textShouldBeginEditing:)`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textShouldBeginEditing:)), unless the delegate doesn’t respond to that method, in which case it returns <doc://com.apple.documentation/documentation/Swift/true>, thereby allowing text editing to proceed.

This method is invoked to let the [`NSTextField`](/documentation/AppKit/NSTextField) respond to impending changes to its text. This method’s default behavior is to send [`control(_:textShouldBeginEditing:)`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textShouldBeginEditing:)) to the receiver’s delegate (passing the receiver and `textObject` as parameters).

## See Also

[`delegate`](/documentation/AppKit/NSMatrix/delegate)

The delegate for messages from the field editor.



---

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)