---
title: IMKInputController
framework: InputMethodKit
role: symbol
role_heading: Class
platforms: [macOS 10.5+]
path: inputmethodkit/imkinputcontroller
---

# IMKInputController

The IMKInputController class provides a base class for custom input controller classes. The IMKServer  class, which is allocated in the main function of an input method, creates an input controller object for each input session created by a client application. For every input session there is a corresponding IMKInputController object.

## Declaration

```swift
class IMKInputController
```

## Overview

Overview An IMKInputController object controls text input on the input method side. It manages events and text from the applications and converted text from the input method engine. IMKInputController implements fully the IMKStateSetting and IMKMouseHandling protocols.  Typically you do not need to override this class, but you do need to provide  a delegate object that implements the methods that your are interested in.  The IMKInputController versions of the protocol methods check whether the delegate object implements a method, and  calls the delegate version if it exists.

## Topics

### Initializing an Input Controller

- [init(server:delegate:client:)](inputmethodkit/imkinputcontroller/init(server:delegate:client:).md)

### Working with Ranges

- [compositionAttributes(at:)](inputmethodkit/imkinputcontroller/compositionattributes(at:).md)
- [selectionRange()](inputmethodkit/imkinputcontroller/selectionrange().md)
- [replacementRange()](inputmethodkit/imkinputcontroller/replacementrange().md)
- [mark(forStyle:at:)](inputmethodkit/imkinputcontroller/mark(forstyle:at:).md)

### Managing the Delegate

- [delegate()](inputmethodkit/imkinputcontroller/delegate().md)
- [setDelegate(_:)](inputmethodkit/imkinputcontroller/setdelegate(_:).md)

### Getting the Client and Server Objects

- [server()](inputmethodkit/imkinputcontroller/server().md)
- [client()](inputmethodkit/imkinputcontroller/client().md)

### Tracking Selections

- [annotationSelected(_:forCandidate:)](inputmethodkit/imkinputcontroller/annotationselected(_:forcandidate:).md)
- [candidateSelectionChanged(_:)](inputmethodkit/imkinputcontroller/candidateselectionchanged(_:).md)
- [candidateSelected(_:)](inputmethodkit/imkinputcontroller/candidateselected(_:).md)

### Managing Composition

- [updateComposition()](inputmethodkit/imkinputcontroller/updatecomposition().md)
- [cancelComposition()](inputmethodkit/imkinputcontroller/cancelcomposition().md)

### Hiding the User Interface

- [hidePalettes()](inputmethodkit/imkinputcontroller/hidepalettes().md)

### Working with Custom Commands

- [doCommand(by:command:)](inputmethodkit/imkinputcontroller/docommand(by:command:).md)
- [menu()](inputmethodkit/imkinputcontroller/menu().md)

### Instance Methods

- [inputControllerWillClose()](inputmethodkit/imkinputcontroller/inputcontrollerwillclose().md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [IMKMouseHandling](inputmethodkit/imkmousehandling.md)
- [IMKStateSetting](inputmethodkit/imkstatesetting.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Classes

- [IMKCandidates](inputmethodkit/imkcandidates.md)
- [IMKServer](inputmethodkit/imkserver.md)
