<!--
{
  "availability" : [
    "iOS: 3.2.0 -",
    "iPadOS: 3.2.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextInputStringTokenizer/init(textInput:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITextInputStringTokenizer(im)initWithTextInput:"
  },
  "title" : "init(textInput:)"
}
-->

# init(textInput:)

Returns an object initialized with the document object that directly communicates with the text input system.

```
init(textInput: any UIResponder & UITextInput)
```

## Parameters

`textInput`

The document object in the application that adopts the [`UITextInput`](/documentation/UIKit/UITextInput) protocol for the purposes of communicating with the text input system.

## Return Value

An instance of a subclass of [`UITextInputStringTokenizer`](/documentation/UIKit/UITextInputStringTokenizer), or `nil` if the object couldn’t be created.

## Discussion

The subclass of [`UITextInputStringTokenizer`](/documentation/UIKit/UITextInputStringTokenizer) shouldn’t retain `textInput`; the tokenizer should always have a lifetime bounded by that of the [`UITextInput`](/documentation/UIKit/UITextInput)-conforming object and a retaining reference would create a retain cycle.

---

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)