TextKit
Manage text storage and perform custom layout of text-based content in your app’s views.
Overview
TextKit provides several classes to control the layout of text, such as NSTextContentStorage, NSTextLayoutManager, and NSTextContainer.
Additionally, TextKit uses NSAttributedString objects extensively. The NSTextStorage class is a subclass of NSMutableAttributedString, and many of the TextKit classes, for example, the classes listed in Formatted content, focus on creating complex NSAttributedString instances. Use these classes to specify your text’s format.
Most of the time, you can use TextKit to fine tune the formatting and layout of a NSTextView by modifying various properties of your view’s layout manager, text container, or text storage objects in your app. If you need more control, you can also use TextKit to build your text controls.
Topics
Text management
Formatting and attributes
Content elements
Location and selection
Layout
Using TextKit 2 to interact with textNSTextLayoutManagerNSTextContainerNSTextLayoutFragmentNSTextLineFragmentNSTextViewportLayoutControllerNSTextLayoutOrientationProvider
Attachments
NSTextAttachmentNSTextAttachmentViewProviderNSAdaptiveImageGlyphNSTextAttachmentContainerNSTextAttachmentLayoutNSTextAttachmentCellNSTextAttachmentCellProtocol