<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "InputMethodKit",
  "identifier" : "/documentation/InputMethodKit/IMKInputController/selectionRange()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "InputMethodKit"
    ],
    "preciseIdentifier" : "c:objc(cs)IMKInputController(im)selectionRange"
  },
  "title" : "selectionRange()"
}
-->

# selectionRange()

Returns where the range of the selection that should be placed inside marked text.

```
func selectionRange() -> NSRange
```

## Return Value

The range of the selection.

## Discussion

This method is called by [`updateComposition()`](/documentation/InputMethodKit/IMKInputController/updateComposition()) to obtain the selection range for marked text. The default implementation sets the selection range at the end of the marked text. You should override this method if your input method provides font or glyph information.

---

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)