A range of characters in a text container, identified by a starting index and an ending index in string backing a text-entry object.
- iOS 3.2+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
Classes that adopt the
UIText protocol must create custom
UIText objects for representing ranges within the text managed by the class. The starting and ending indexes of the range are represented by
UIText objects. The text system uses both
UIText objects for communicating text-layout information. There are two reasons for using objects for text ranges rather than primitive types such as
Some documents contain nested elements (for example, HTML tags and embedded objects) and you need to track both absolute position and position in the visible text.
The WebKit framework requires that text indexes and offsets be represented by objects.