Nerdy internals of an Apple text editor (
from tedu to programming on 05 Mar 2024 23:28

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.


threaded - newest