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

# control(_:textShouldBeginEditing:)

Invoked when the user tries to enter a character in a cell of a control that allows editing of text (such as a text field or form field).

```
@MainActor optional func control(_ control: NSControl, textShouldBeginEditing fieldEditor: NSText) -> Bool
```

## Parameters

`control`

The control whose content is about to be edited.

`fieldEditor`

The field editor of the control.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the control’s field editor should be allowed to start editing the text; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

You can use this method to allow or disallow editing in a control. This message is sent by the control directly to its delegate object.

---

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)