Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Plug-ins

Plug-ins are the standard way to extend many applications and system behaviors. Plug-ins are bundles whose code is loaded dynamically into the runtime of an application. Because they are loaded dynamically, they can be added and removed by the user.

There are many opportunities for developing plug-ins for Mac OS X. Developers can create plug-ins for third-party applications or for Mac OS X itself. Some parts of Mac OS X define plug-in interfaces for extending the basic system behavior. The following sections list many of these opportunities for developers, although other software types may also use the plug-in model.

Important: With the transition to Intel-based processors, developers should always create universal binaries for plug-ins written with Carbon, Cocoa, or BSD APIs. For information on how to create universal binaries, see Universal Binary Programming Guidelines, Second Edition.

In this section:

Address Book Action Plug-Ins
Application Plug-Ins
Automator Plug-Ins
Contextual Menu Plug-Ins
Core Audio Plug-Ins
Image Units
Input Method Components
Interface Builder Plug-Ins
Metadata Importers
QuickTime Components
Safari Plug-ins


Address Book Action Plug-Ins

An Address Book action plug-in lets you populate the pop-up menus of the Address Book application with custom menu items that use Address Book data to trigger a specific event. For example, you could add an action to a phone number field to trigger the dialing of the number using a Bluetooth-enabled phone.

Address Book action plug-ins are best suited for developers who want to extend the behavior of the Address Book application to support third-party hardware or software. For more information on creating an Address Book action plug-in, see the documentation for the ABActionDelegate class.

Application Plug-Ins

Several applications, including iTunes, Final Cut Pro, and Final Cut Express, use plug-ins to extend the features available from the application. You can create plug-ins to implement new effects for these applications or for other applications that support a plug-in model. For information about developing plug-ins for Apple applications, visit the ADC website at http://developer.apple.com/.

Automator Plug-Ins

Introduced in Mac OS X version 10.4, Automator is a workflow-based application that lets users assemble complex scripts graphically using a palette of available actions. You can extend the default set of actions by creating Automator plug-ins to support new actions. Because they can be written in AppleScript or Objective-C, you can write plug-ins for your own application’s features or for the features of other scriptable applications.

If you are developing an application, you should think about providing Automator plug-ins for your application’s most common tasks. AppleScript is one of the easiest ways for you to create Automator plug-ins because it can take advantage of existing code in your application. If you are an Objective-C developer, you can also use that language to create plug-ins.

For information on how to write an Automator plug-in, see Automator Programming Guide.

Contextual Menu Plug-Ins

The Finder associates contextual menus with file-system items to give users a way to access frequently used commands quickly. Third-party developers can extend the list of commands found on these menus by defining their own contextual menu plug-ins. You might use this technique to make frequently used features available to users without requiring them to launch your application. For example, an archiving program might provide commands to compress a file or directory.

The process for creating a contextual menu plug-in is similar to that for creating a regular plug-in. You start by defining the code for registering and loading your plug-in, which might involve creating a factory object or explicitly specifying entry points. To implement the contextual menu behavior, you must then implement several callback functions defined by the Carbon Menu Manager for that purpose. Once complete, you install your plug-in in the Library/Contextual Menu Items directory at the appropriate level of the system, usually the local or user level.

For information on how to create a plug-in, see Plug-ins. For information on the Carbon Menu Manager functions you need to implement, see Menu Manager Reference.

Core Audio Plug-Ins

The Core Audio system supports plug-ins for manipulating audio streams during most processing stages. You can use plug-ins to generate, process, receive, or otherwise manipulate an audio stream. You can also create plug-ins to interact with new types of audio-related hardware devices.

For an introduction to the Core Audio environment, download the Core Audio SDK from http://developer.apple.com/sdk/ and read the documentation that comes with it. Information is also available in Reference Library > Audio > Core Audio.

Image Units

In Mac OS X version 10.4 and later, you can create image units for the Core Image and Core Video technologies. An image unit is a collection of filters packaged together in a single bundle. Each filter implements a specific manipulation for image data. For example, you could write a set of filters that perform different kinds of edge detection and package them as one image unit.

For more information about Core Image, see Core Image Programming Guide.

Input Method Components

An input method component is a code module that processes incoming data and returns an adjusted version of that data. A common example of an input method is an interface for typing Japanese or Chinese characters using multiple keystrokes. The input method processes the user keystrokes and returns the complex character that was intended. Other examples of input methods include spelling checkers and pen-based gesture recognition systems.

Input method components are implemented using the Carbon Component Manager. An input method component provides the connection between Mac OS X and any other programs your input method uses to process the input data. For example, you might use a background application to record the input keystrokes and compute the list of potential complex characters that those keystrokes can create.

In Mac OS X v10.5 and later, you can create input methods using the Input Method Kit (InputMethodKit.framework). For information on how to use this framework, see Input Method Kit Framework Reference. For information on how to create an input method in earlier versions of Mac OS X, see the BasicInputMethod sample code and the Component Manager Reference.

Interface Builder Plug-Ins

If you create any custom controls for your application, you can create an Interface Builder plug-in to make those controls available in the Interface Builder design environment. Creating plug-ins for your controls lets you go back and redesign your application’s user interface using your actual controls, as opposed to generic custom views. For controls that are used frequently in your application, being able to see and manipulate your controls directly can eliminate the need to build your application to see how your design looks.

In Mac OS X v10.5, you should include plug-ins for any of your custom controls inside the framework bundle that implements those controls. Bundling your plug-in with your framework is not required but does make it easier for users. When the user adds your framework to their Xcode project, Interface Builder automatically scans the framework and loads the corresponding plug-in if it is present. If you did not use a framework for the implementation of your controls, you must distribute the plug-in yourself and instruct users to load it using the Interface Builder preferences window.

For information on how to create plug-ins that support Interface Builder 3.0 and later, see Interface Builder Plug-In Programming Guide and Interface Builder Kit Framework Reference. For information on how to create plug-ins for earlier versions of Interface Builder, see the header files for Interface Builder framework (InterfaceBuilder.framework) or the examples in <Xcode>/Examples/Interface Builder.

Metadata Importers

In Mac OS X version 10.4 and later, you can create a metadata importer for your application’s file formats. Metadata importers are used by Spotlight to gather information about the user’s files and build a systemwide index. This index is then used for advanced searching based on more user-friendly information.

If your application defines a custom file format, you should always provide a metadata importer for that file format. If your application relies on commonly used file formats, such as JPEG, RTF, or PDF, the system provides a metadata importer for you.

For information on creating metadata importers, see Spotlight Importer Programming Guide.

QuickTime Components

A QuickTime component is a plug-in that provides services to QuickTime-savvy applications. The component architecture of QuickTime makes it possible to extend the support for new media formats, codecs, and hardware. Using this architecture, you can implement components for the following types of operations:

For an overview of QuickTime components, see QuickTime Overview. For information on creating specific component types, see the subcategories in Reference Library > QuickTime.

Safari Plug-ins

Beginning with Mac OS X version 10.4, Safari supports a new plug-in model for tying in additional types of content to the web browser. This new model is based on an Objective-C interface and offers significant flexibility to plug-in developers. In particular, the new model lets plug-in developers take advantage of the Tiger API for modifying DOM objects in an HTML page. It also offers hooks so that JavaScript code can interact with the plug-in at runtime.

Safari plug-in support is implemented through the new WebPlugIn object and related objects defined in Web Kit. For information about how to use these objects, see Web Kit Plug-In Programming Topics and Web Kit Objective-C Framework Reference.



< Previous PageNext Page > Hide TOC


Last updated: 2007-10-31




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice