iOS Developer Library — Prerelease


App Extension Programming Guide

On This Page

App Extensions Increase Your Impact

Starting in iOS 8.0 and OS X v10.10, an app extension lets you extend custom functionality and content beyond your app and make it available to users while they’re using other apps or the system. You create an app extension to enable a specific task; after users get your extension, they can use it to perform that task in a variety of contexts. For example, if you provide an extension that enables sharing to your social sharing website, users can use it to post a remark while surfing the web. Or if you provide an extension that displays current sports scores, users can put it in Notification Center so that they can get the latest scores when they open the Today view. You can even create an extension that provides a custom keyboard that users can use in place of the iOS system keyboard.

There Are Several Types of App Extensions

iOS and OS X define several types of app extensions, each of which is tied to an area of the system, such as sharing, Notification Center, and the iOS keyboard. A system area that supports extensions is called an extension point. Each extension point defines usage policies and provides APIs that you use when you create an extension for that area. You choose an extension point to use based on the functionality you want to provide.

Table 1-1 lists the extension points in iOS and OS X and gives an example of tasks you might enable in an app extension for each extension point.

Table 1-1Extension points in iOS and OS X

Extension point

Typical app extension functionality

Today (iOS and OS X)

Get a quick update or perform a quick task in the Today view of Notification Center

(A Today extension is called a widget)

Share (iOS and OS X)

Post to a sharing website or share content with others

Action (iOS and OS X; UI and non-UI variants)

Manipulate or view content originating in a host app

Photo Editing (iOS)

Edit a photo or video within the Photos app

Finder Sync (OS X)

Present information about file sync state directly in Finder.

Document Provider (iOS; UI and non-UI variants)

Provide access to and manage a repository of files.

Custom Keyboard (iOS)

Replace the iOS system keyboard with a custom keyboard for use in all apps

Watch App (iOS)

Provide an app, a glance, or a notification UI for Apple Watch, as described in WatchKit Programming Guide.

Because the system defines specific areas for app extensions, it’s important to choose the area that best matches the functionality you want to deliver. For example, if you want to create an extension that enables a sharing experience, use the Share extension point, starting with the Share Extension Xcode template.

Xcode and the App Store Help You Create and Deliver App Extensions

An app extension is different from an app. Although you must use an app to contain and deliver your extensions, each extension is a separate binary that runs independent of the app used to deliver it.

You create an app extension by adding a new target to an app. As with any target, an extension target specifies settings and files that combine to build a product within your app project. You can add multiple extension targets to a single app (an app that contains one or more extensions is called a containing app).

The best way to start developing an app extension is to use one of the templates that Xcode provides for each extension point on both platforms. Each template includes extension point–specific implementation files and settings, and produces a separate binary that gets added to your containing app’s bundle.

To distribute app extensions to users, you submit a containing app to the App Store. When a user installs your containing app, the extensions it contains are also installed.

After installing an app extension, a user must take action to enable it. Often, users can enable an extension within the context of their current task. If your extension is a Today widget, for example, users can edit the Today view in Notification Center to enable your extension. In other cases, users can use Settings (in iOS) or System Preferences (in OS X) to enable and manage the extensions they install.

Users Experience App Extensions in Different Contexts

Although each type of app extension enables a different type of task, there are some parts of the user experience that are common to most extensions. As you think about designing an extension, it’s important to understand the user experience that’s intended by the extension point you choose. At a high level, the best user experience for all extensions is quick, streamlined, and focused on a single task.

Users open your app extension by interacting with some system-provided user interface (UI). For example, a user accesses a Share extension by activating the system-provided Share button in an app and choosing the extension from the list that’s displayed.

Although most app extensions provide at least some custom UI elements, users don’t see your custom UI until they enter your extension. When users enter your extension, your custom UI can help to show them that they’re shifting into a new context. Because users can distinguish your extension from the current app, they can appreciate the unique functionality that you provide. Users’ awareness of extensions as separate entities also means that they can identify and remove extensions that misbehave or don’t perform well.

To give users a smooth transition into your app extension, you generally want to balance your custom design with the UI that’s associated with the extension point. For example, it’s a good idea to make your widget look like it belongs in the Today view. Similarly, in your Photo Editing extension, it works well to create a UI that harmonizes with Photos in iOS.