<!--
{
  "availability" : [
    "iOS: 3.2.0 -",
    "iPadOS: 3.2.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextInput/textStyling(at:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextInput(im)textStylingAtPosition:inDirection:"
  },
  "title" : "textStyling(at:in:)"
}
-->

# textStyling(at:in:)

Returns a dictionary with properties that specify how to style the text at a certain location in a document.

```
optional func textStyling(at position: UITextPosition, in direction: UITextStorageDirection) -> [NSAttributedString.Key : Any]?
```

## Parameters

`position`

An object that indicates a location in the text of a document.

`direction`

The direction of the styling attributes in text storage.

## Return Value

A dictionary whose elements are one or more of the key-value pairs defining text color, font, and background color. See [Style dictionary keys](/documentation/UIKit/style-dictionary-keys) for descriptions of these key-value pairs.

## Discussion

Text styling information can affect, for example, the appearance of a correction rectangle.

---

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)