---
title: "textShouldBeginEditing(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextdelegate/textshouldbeginediting(_:)"
---

# textShouldBeginEditing(_:)

Invoked when a text object begins to change its text, this method requests permission for aTextObject to begin editing.

## Declaration

```swift
@MainActor optional func textShouldBeginEditing(_ textObject: NSText) -> Bool
```

## Discussion

Discussion If the delegate returns true, the text object proceeds to make changes. If the delegate returns false, the text object abandons the editing operation. This method is also invoked when the user drags and drops a file onto the text object.

## See Also

### Related Documentation

- [becomeFirstResponder()](appkit/nsresponder/becomefirstresponder().md)
- [makeFirstResponder(_:)](appkit/nswindow/makefirstresponder(_:).md)

### Editing text

- [textDidBeginEditing(_:)](appkit/nstextdelegate/textdidbeginediting(_:).md)
- [textShouldEndEditing(_:)](appkit/nstextdelegate/textshouldendediting(_:).md)
- [textDidEndEditing(_:)](appkit/nstextdelegate/textdidendediting(_:).md)
