---
title: markedRange()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nstextinputclient/markedrange()
---

# markedRange()

Returns the range of the marked text.

## Declaration

```swift
func markedRange() -> NSRange
```

## Return Value

Return Value The range of marked text or {NSNotFound, 0} if there is no marked range.

## Discussion

Discussion The returned range measures from the start of the receiver’s text storage. The return value’s location is NSNotFound and its length is 0 if and only if hasMarkedText() returns false.

## See Also

### Handling marked text

- [hasMarkedText()](appkit/nstextinputclient/hasmarkedtext().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)
