---
title: hasMarkedText()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nstextinputclient/hasmarkedtext()
---

# hasMarkedText()

Returns a Boolean value indicating whether the receiver has marked text.

## Declaration

```swift
func hasMarkedText() -> Bool
```

## Return Value

Return Value true if the receiver has marked text; otherwise false.

## Discussion

Discussion The text view itself may call this method to determine whether there currently is marked text. NSTextView, for example, disables the Edit > Copy menu item when this method returns true.

## See Also

### Handling marked text

- [markedRange()](appkit/nstextinputclient/markedrange().md)
- [selectedRange()](appkit/nstextinputclient/selectedrange().md)
- [setMarkedText(_:selectedRange:replacementRange:)](appkit/nstextinputclient/setmarkedtext(_:selectedrange:replacementrange:).md)
- [unmarkText()](appkit/nstextinputclient/unmarktext().md)
- [validAttributesForMarkedText()](appkit/nstextinputclient/validattributesformarkedtext().md)
