Cocoa is Apple's native object-oriented application programming interface (API) for its desktop operating system macOS.
It is also possible to write Objective-C Cocoa programs in a simple text editor and build it manually with GNU Compiler Collection (GCC) or Clang from the command line or from a makefile.
Such applications usually have a familiar look and feel, since the Cocoa programming environment provides a lot of common UI elements (such as buttons, scroll bars, etc.
For iOS, iPadOS, tvOS, and watchOS, APIs similar to Application Kit, named UIKit and WatchKit, are available; they include gesture recognition, animation, and a different set of graphical control elements that are designed to accommodate the specific platforms they target.
Apple acquired NeXT in December 1996, and subsequently went to work on the Rhapsody operating system that was to be the direct successor of OPENSTEP.
The API toolbox was originally called “Yellow Box” and was renamed to Cocoa - a name that had been already trademarked by Apple.
A method titled retainCount exists, but contrary to its name, will usually not return the exact retain count of an object.
In 2011, the LLVM compiler introduced Automatic Reference Counting (ARC), which replaces the conventional garbage collector by performing static analysis of Objective-C source code and inserting retain and release messages as necessary.
This is organized along conventional lines for an application framework, but is based on the Portable Document Format (PDF) drawing model provided by Quartz.
Since the Cocoa framework manages all the clipping, scrolling, scaling and other chores of drawing graphics, the programmer is freed from implementing basic infrastructure and can concentrate on the unique aspects of an application's content.
The Smalltalk teams at Xerox PARC eventually settled on a design philosophy that led to easy development and high code reuse.
During the transition to Cocoa, the model layer was expanded greatly, introducing a number of pre-rolled classes to provide functionality common to desktop applications.
In Mac OS X 10.3, Apple introduced the NSController family of classes, which provide predefined behavior for the controller layer.
With the arrival of Mac OS X 10.4, Apple extended this foundation further by introducing the Core Data framework, which standardizes change tracking and persistence in the model layer.
In providing framework support for all three MVC domains, Apple's goal is to reduce the amount of boilerplate or "glue" code that developers have to write, freeing up resources to spend time on application-specific features.
This restricts the design of an application since specific command handling classes are needed, usually organized according to the chain-of-responsibility pattern.
Since the selector is text data, this lets it be saved to a file, transmitted over a network or between processes, or manipulated in other ways.
By a similar token, Cocoa provides a pervasive data manipulation method called key-value coding (KVC).
Also, by extending this system using something Cocoa terms key-value observing (KVO), automatic support for undo-redo is provided.
Paragraph layout can be controlled automatically or by the user, using a built-in "ruler" object that can be attached to any text view.