Cocoa text system

The Cocoa text system is the linked network of classes, protocols, interfaces and objects that provide typography and text field editing capabilities to Cocoa applications on macOS. It is the primary text-handling system in macOS.[1] Although "extremely complex", the standard text-handling abilities of the Cocoa text system have been widely praised as without peer.[2][3] GNUSTEP implements a similar, broadly-compatible system.[4]

Derived from OPENSTEP, the Cocoa text system can use many Emacs keybindings for programmer familiarity.[5] Users interact with two classes, NSTextField (providing single-line edit fields) or NSTextView (providing multi-line editing). Each NSTextField uses a shared instance of a NSTextView called the "field editor". This was done to reduce high memory requirements that would arise if every field implemented its own NSTextView object graph when only one field can actually have focus at any time.[6]

The Cocoa text system uses a Model-View-Controller layout.[7] The view layer is handled by NSTextView and NSTextField, NSLayoutManager and NSTextContainer are the controller layer, and NSTextStorage (a mutable string subclass) is the model.[8]

The Cocoa text system also interacts with Services to provide standard streams functionality in a GUI environment. It is possible to implement a fully featured rich text editor in only a few lines of code.[9][10]

References

External links

This article is issued from Wikipedia - version of the 9/23/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.