Join Bill Weinman for an in-depth discussion in this video What is Text Kit?, part of iOS 9 App Development: Text Kit.
- TextKit represents a fundamental shift in how text works in iOS. In order to understand this we need to understand how text used to work in iOS. iOS provides three high level classes for displaying and editing text. UILabel for displaying a single line of text on the screen. UITextField for editing a single line of text. And UITextView for displaying or editing a block of text. Initial versions of these classes allowed very little formatting. You could set the font and the color but not much beyond that.
The architecture for early iOS tech support looked like this. All the text rendering classes originally used a stripped down WebKit to display text. This was severely limiting and made text formatting cumbersome, awkward and slow. Beginning with iOS 7 TextKit was introduced and by the time of iOS 8 it was fully integrated into the system displacing WebKit for everything but web views. Now all text formatting uses TextKit. This architecture is simpler, easier to use, much more flexible and performs significantly better.
TextKit provides a great number of features to support text formatting. Including Dynamic Type which provides support for global accessibility settings for changing the size of type. Kerning and Ligatures make text more readable by allowing text to flow organically. And Exclusion Paths which allow text to wrap around shapes on the screen. TextKit is a huge advancement over the previous architecture for handling texts on iOS. In the rest of this course I'll show you how to use some of it's more common and important features in your applications.