TextKit is a special framework that sits between UIKit/AppKit and CoreText

In case you’re in doubt on which UIKit element you need:

..and for AppKit:

If we have a lot of text do format,
UITextViewhas aallowsNonContiguousLayoutproperty that will format the text only when it is visualized, therefore not requiring the whole text to be formatted before displaying to the user (requires theUITextView’s scrolling to be enabled, otherwise asking for the intrinsic size of theUITextViewwill need to format the whole text before returning)For security, all text input is potentially untrusted. Therefore before processing any input (what happens if a user pastes a 3M+ words book in our text input?) we should take a look at
UITextFieldDelegate(UIKit) andNSFormatter(AppKit).
TextKit Best Practices
Leverage the abilities of TextKit to provide the best experience possible displaying and editing text. Get the best performance out of your app by using TextKit effectively. Learn the concepts to do more complex handling, layout and presentation.
Missing anything? Corrections? Contributions are welcome!
Written By

zntfdr