---
title: TextKit
framework: uikit
role: collectionGroup
role_heading: API Collection
path: uikit/textkit
---

# TextKit

Manage text storage and perform custom layout of text-based content in your app’s views.

## Overview

Overview TextKit is a powerful and versatile text layout and rendering engine available in UIKit and AppKit. It provides several classes to control the layout of text, including NSTextLayoutManager, NSTextContentStorage, NSTextViewportLayoutController, and NSTextContainer. In UIKit, you can use UITextView, which packages TextKit capabilities to provide a convenient text rendering and editing experience. UITextView uses NSTextContentStorage as the text backing store manager. NSTextContentStorage uses an instance of NSTextStorage as the backing store, which is a subclass of NSMutableAttributedString. For an example, see Enriching your text in text views. Alternatively, you can build custom text views using your own UIView or CALayer by rendering text provided by the TextKit text engine. Use NSTextContentStorage if you want an NSAttributedString-related storage type, or subclass NSTextContentManager to use your own. For an example, see Using TextKit 2 to interact with text. When using UITextView, access the TextKit engine through the view’s textLayoutManager, textContainer, and textStorage properties. UITextView provides access to two layout engines: the modern textLayoutManager, which uses NSTextLayoutManager, and the legacy layoutManager, which uses NSLayoutManager. Use textLayoutManager for better performance, and support for international languages. Because TextKit classes are available in both UIKit and AppKit, the same techniques apply across iOS, iPadOS, macOS, tvOS, and visionOS.

## Topics

### Text management

- [NSTextContentStorage](uikit/nstextcontentstorage.md)
- [NSTextContentManager](uikit/nstextcontentmanager.md)
- [NSAttributedString](foundation/nsattributedstring.md)
- [NSMutableAttributedString](foundation/nsmutableattributedstring.md)

### Formatting and attributes

- [NSParagraphStyle](uikit/nsparagraphstyle.md)
- [NSMutableParagraphStyle](uikit/nsmutableparagraphstyle.md)
- [NSTextTab](uikit/nstexttab.md)
- [NSTextList](uikit/nstextlist.md)
- [Adding tables to attributed strings in UIKit](uikit/adding-tables-to-attributed-strings.md)

### Tables

- [Adding tables to attributed strings in UIKit](uikit/adding-tables-to-attributed-strings.md)
- [NSTextTable](uikit/nstexttable.md)
- [NSTextTableBlock](uikit/nstexttableblock.md)
- [NSTextBlock](uikit/nstextblock.md)

### Content elements

- [Enriching your text in text views](uikit/enriching-your-text-in-text-views.md)
- [NSTextParagraph](uikit/nstextparagraph.md)
- [NSTextListElement](uikit/nstextlistelement.md)
- [NSTextElement](uikit/nstextelement.md)
- [NSTextElementProvider](uikit/nstextelementprovider.md)

### Location and selection

- [NSTextRange](uikit/nstextrange.md)
- [NSTextSelection](uikit/nstextselection.md)
- [NSTextSelectionNavigation](uikit/nstextselectionnavigation.md)
- [NSTextLocation](uikit/nstextlocation.md)

### Layout

- [Using TextKit 2 to interact with text](uikit/using-textkit-2-to-interact-with-text.md)
- [Display text with a custom layout](uikit/display-text-with-a-custom-layout.md)
- [Managing viewport layout and attachment reuse in text views](uikit/managing-viewport-layout-and-attachment-reuse-in-a-text-view-subclass.md)
- [NSTextLayoutManager](uikit/nstextlayoutmanager.md)
- [NSTextContainer](uikit/nstextcontainer.md)
- [NSTextLayoutFragment](uikit/nstextlayoutfragment.md)
- [NSTextLineFragment](uikit/nstextlinefragment.md)
- [NSTextViewportLayoutController](uikit/nstextviewportlayoutcontroller.md)
- [NSTextViewportRenderingSurface](uikit/nstextviewportrenderingsurface.md)
- [NSTextViewportRenderingSurfaceKey](uikit/nstextviewportrenderingsurfacekey.md)
- [NSTextLayoutOrientationProvider](uikit/nstextlayoutorientationprovider.md)

### Attachments

- [NSTextAttachment](uikit/nstextattachment.md)
- [NSTextAttachmentViewProvider](uikit/nstextattachmentviewprovider.md)
- [NSAdaptiveImageGlyph](uikit/nsadaptiveimageglyph.md)
- [NSTextAttachmentContainer](uikit/nstextattachmentcontainer.md)
- [NSTextAttachmentLayout](uikit/nstextattachmentlayout.md)

### TextKit 1

- [NSTextStorage](uikit/nstextstorage.md)
- [NSLayoutManager](uikit/nslayoutmanager.md)

## See Also

### Text

- [Text display and fonts](uikit/text-display-and-fonts.md)
- [Keyboards and input](uikit/keyboards-and-input.md)
- [Writing Tools](uikit/writing-tools.md)
- [Handwriting recognition](uikit/handwriting-recognition.md)
