Chapter 13. Bundles and Resources

Even though it may look like a single file in the Finder, a Cocoa application is actually a collection of files in a special directory structure known as a bundle. Bundle directories in the filesystem have a special significance that the Finder understands and that allows users to treat applications, as well as other types of bundles, as a single entity. This allows users to install an application simply by dragging it from a CD image and relocate it by dragging it around the filesystem.

There are three general types of bundles:

Application bundles

Application bundles contain an executable and all its related resources, such as nib files, image files, and localized strings. For example, most of the applications installed in the /Applications folder are application bundles.

Plug-in bundles

Plug-in bundles provide code that extends or enhances the functionality of a host application in some way. They plug into some kind of architecture provided by the host application. An example of a plug-in bundle is the screensaver modules installed in the /System/Library/Screen Savers folder. Each of these bundles is used by the screensaver system (whose control panel is in the System Preferences).

Framework bundles

Framework bundles contain dynamic shared libraries, as well as header files, images, and documentation. For example, the two Cocoa frameworks, Foundation and AppKit, are packaged as framework bundles in the /System/Library /Frameworks folder. Framework ...

Get Learning Cocoa with Objective-C, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.