TextKit Overview
TextKit goes back to the NeXT era, before Mac OS X was a thing. After the relatively new Cocoa frameworks for Mac app programming were introduced and introduced the “Cocoa Text System” title, iOS and UIKit stuck with “TextKit”, and in 2021 TextKit 2 returned.
This revolves around everything related to accepting textual user input on the Mac:
-
NSTextViewfor the UI component, -
NSTextStoragefor the processing of text and style changes, -
NSLayoutManagerfor the computation of line and glyph sizes, and for applying styles, -
NSTypesetterfor putting glyphs on the screen.
Even NSTextFields are just reusing a shared NSTextView, called the window’s field editor. It’s everywhere.
- TextKit API docs: describes all core components and, since TextKit 2, comes with sample projects and WWDC links.
- TextKit 2 Introduction (WWDC 2021)