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

# cancelComposition()

Stops the current composition and replaces marked text with the original text.

```
func cancelComposition()
```

## Discussion

This method calls the method originalString: to obtain the original text and sends that text to the client using a call to the `IMKTextInput`  protocol method `insertText(_:replacementRange:)`

---

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)