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:
-
NSTextView
for the UI component, -
NSTextStorage
for the processing of text and style changes, -
NSLayoutManager
for the computation of line and glyph sizes, and for applying styles, -
NSTypesetter
for putting glyphs on the screen.
Even NSTextField
s 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)
Related Posts on the Blog
Dec 4 2022 |
ChatGPT: Publish NSTextView Changes to ReSwift, but Also Use a Lamport Clock Conversation log with ChatGPT. |
Sep 23 2022 |
NSTextView (Plain Text) and the Pasteboard: PasteboardType.string Is Not Handled |
Sep 21 2022 | |
Sep 13 2022 |
How to Fix When Some Text Changes Don't Come with Automatic Undo? |
May 9 2022 | |
May 9 2022 | |
May 2 2022 | |
Mar 9 2022 | |
Nov 24 2021 |
What Do You Get When You Drag and Drop a PNG File From Finder Into an NSTextView? |
Sep 21 2021 |
NSTextView Performance May Degrade for Large Plain Text Documents When usesFontPanel Is Active |
Aug 26 2021 | |
Jun 23 2021 | |
Feb 10 2021 |
Disable NSTextAttachment Action and Sharing Services Menu Drop-Down |
Nov 18 2020 | |
Oct 19 2020 | |
Oct 19 2019 | |
Jun 23 2018 |
NSTextField usesSingleLineMode Stops Working When You Implement NSTextViewDelegate Methods |
Apr 24 2018 | |
Mar 7 2018 |
NSTextView's Default Insertion Point and Selected Text Colors |
Feb 6 2018 | |
Nov 29 2017 | |
Aug 9 2017 | |
Jul 15 2017 | |
Jul 11 2017 | |
Mar 3 2017 |