Nerdy internals of an Apple text editor

To understand how text editing works in native Apple text editors, we first need to discuss the centerpiece of the whole system β€” the TextView class. Technically, NSTextView and UITextView have their differences, but the API is similar enough that we can treat them as a single TextView class. I will highlight the differences where necessary.

TextView is a massive component that only grows in complexity with each release of respective operating systems. The TextEdit app consists almost entirely of a single TextView. When a single class can be used to build an entire app β€” you know it’s a beast.


A lovely deep dive in TextView and related API's.

Very well written, accompanied with good images/videos to explain something, absolutely worth the read.

Especially if you want to know more about NSTextView, NSTextStorage, NSTextContainer, NSLayoutManager, NSScrollView, NSAttributedString, and much more.

#100DaysToOffload 15/100