The fundamental storage mechanism of TextKit.
- iOS 7.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
NSText is a semi concrete subclass of
NSMutable that adds behavior for managing a set of client
NSLayout objects. A text storage object notifies its layout managers of changes to its characters or attributes, which lets the layout managers redisplay the text as needed.
A text storage object can be accessed from any thread of your app, but your app must guarantee access from only one thread at a time.
NSText class implements change management (via the
end methods), verification of attributes, delegate handling, and layout management notification. The one aspect it does not implement is managing the actual attributed string storage, which subclasses manage by overriding the two
Subclasses must also override two
These primitives should perform the change, then call
edited(_: to let the parent class know what changes were made.