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

# hasMarkedText()

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

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

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the receiver has marked text; otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## 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 <doc://com.apple.documentation/documentation/Swift/true>.

---

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)