Mac OS X - Cocoa

The Cocoa and Cocoa Touch frameworks that power Mac OS X and iPhone OS are tightly integrated into the Xcode development experience. Cocoa’s high-level APIs make is easy to add animation, networking, and the native platform appearance and behavior to your application with only a few lines of code.

Cocoa Frameworks

Cocoa Frameworks

The Cocoa frameworks consist of libraries, APIs, and runtimes that form the development layer for all of Mac OS X. By developing with Cocoa, you will be creating applications the same way Mac OS X itself is created. Your application will automatically inherit the great behaviors and appearances of Mac OS X, with full access to the underlying power of the UNIX operating system. Using Cocoa with the Xcode IDE is simply the best way to create native Mac applications.

The Power of Objective-C

Much of Cocoa is implemented in Objective-C, an object-oriented language that is compiled to run at incredible speed, yet employes a truly dynamic runtime making it uniquely flexible. Because Objective-C is a superset of C, it is easy to mix C and even C++ into your Cocoa applications.

As your application runs, the Objective-C runtime instantiates objects based on executing logic—not just in ways defined during compilation. For example, a running Objective-C application can load an interface (a nib file created by Interface Builder), connect the Cocoa objects in the interface to your application code, then run the correct method once the UI button is pressed. No recompiling is necessary.

Objective-C’s dynamic runtime is similar to many modern scripting languages, making it easy to map Cocoa’s features to other languages using the Cocoa Bridge. With the Cocoa Bridge, developers can create first-class Mac OS X applications using AppleScript, Ruby, and Python.

Cocoa Uses the Model-View-Controller Design Pattern

Model - View - Controller

Cocoa uses the Model-View-Controller (MVC) design pattern throughout. Models encapsulate application data, Views display and edit that data, and Controllers mediate the logic between the two. By separating responsibilities in this manner, you end up with an application that is easier to design, implement, and maintain.

The MVC pattern means that Interface Builder requires no code to be written or generated while you focus exclusively on the View of your application. Cocoa bindings on the Mac eliminate most of the glue code, making the connection between Controllers coded in Xcode and the Views designed within Interface Builder a simple matter of graphically “wiring” the two together. Interface Builder works with Cocoa to make localizing your application easy so you can quickly enter entirely new markets.

Features List: Frameworks by Category

Cocoa includes primary frameworks such as AppKit and Core Foundation that provide common building blocks for all Mac applications, as well as specialized frameworks for everything from networking and data to graphics and professional audio processing. These frameworks range from high-level Objective-C APIs that can create amazing effects in a few lines of code, down to low-level frameworks to manipulate every aspect of the core system. Here is a small sampling of available frameworks provided by Cocoa:

  • Audio and Video

  • Core Audio
  • Core MIDI
  • Core Video
  • Data Management

  • Core Data
  • Networking and Internet

  • Bonjour
  • Directory Services
  • Kerberos
  • Graphics and Animation

  • Core Animation
  • Core Image
  • OpenGL
  • Quartz
  • QuickTime
  • QTKit
  • Cocoa Bridges to
    Scripting Languages

  • AppleScript
  • Python
  • Ruby
  • User Applications

  • Address Book
  • Calendar Store
  • Instant Message